Skip to content
Snippets Groups Projects
Commit ddad677a authored by Mauricio Giacomini Girardello's avatar Mauricio Giacomini Girardello
Browse files

adding users UI and controller, translating some others controllers

parent d8318560
No related branches found
No related tags found
No related merge requests found
class Management::EstatisticasController < ManagementController
class Management::StatsController < ManagementController
def index
g = Gruff::Line.new
g.title = "Usuários"
......
class Management::UsersController < ManagementController
before_action :set_user, only: [:show, :edit, :update, :destroy]
def index
@users = User.all.order(:name).page(params[:page])
end
# GET /users/1
# GET /users/1.json
def show
end
# GET /users/new
def new
@user = User.new
end
# GET /users/1/edit
def edit
end
# POST /users
# POST /users.json
def create
@user = User.new(user_params)
respond_to do |format|
if @user.save
format.html { redirect_to management_users_path(@user), notice: "User created!" }
format.json { render :show, status: :created, location: @user }
else
format.html { render :new }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /users/1
# PATCH/PUT /users/1.json
def update
respond_to do |format|
if @user.update(user_params)
format.html { redirect_to management_user_path(@user), notice: "#{t('user')} #{t('updated_successfully')}." }
format.json { render :show, status: :ok, location: @user }
else
format.html { render :edit }
format.json { render json: @user.errors, status: :unprocessable_entity }
end
end
end
# DELETE /users/1
# DELETE /users/1.json
def destroy
@user.destroy
respond_to do |format|
format.html { redirect_to management_users_path, notice: "#{t('user')} #{t('destroyed_successfully')}." }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_user
@user = User.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def user_params
params.require(:user).permit(:name, :email, :password, :password_confirmation)
end
end
<h1 class="ls-title-intro ls-ico-users">Estatisticas</h1>
<ol class="ls-breadcrumb">
<li><%= link_to "Início", management_root_path %></li>
<li>Estatísticas</li>
</ol>
<br><br>
<div class="ls-box ls-board-box">
<header class="ls-info-header">
......
<h1><%= t("users") %></h1>
<br>
<div id="inventory-search">
<%= form_tag management_users_index_path, method: 'get' do %>
<div class="flakes-search">
<%= text_field_tag :search, params[:search], class: 'search-box search', placeholder: '', autofocus: '' %>
<h1 class="ls-title-intro ls-ico-users">Usuários</h1>
<a href="#" class="ls-btn-primary" aria-expanded="false" role="combobox">Cadastrar
novo</a>
<div class="ls-box-filter">
<form action="" class="ls-form ls-form-inline ls-float-left">
<label class="ls-label col-md-6 col-sm-8">
<b class="ls-label-text">Status</b>
<div class="ls-custom-select ls-field-sm">
<select name="" class="ls-select">
<option>Todos</option>
<option>Ativos</option>
<option>Desativados</option>
</select>
</div>
</label>
</form>
<form action="" class="ls-form ls-form-inline ls-float-right">
<label class="ls-label" role="search">
<b class="ls-label-text ls-hidden-accessible">Nome do usuário</b>
<input type="text" id="q" name="q" aria-label="Faça sua busca por usuário" placeholder="Nome do usuário" required="" class="ls-field-sm">
</label>
<div class="ls-actions-btn">
<input type="submit" value="Buscar" class="ls-btn ls-btn-sm" title="Buscar" aria-expanded="false" role="combobox">
</div>
<% end %>
<div class="flakes-actions-bar">
<%= link_to t("new_user"), {}, class: 'action button-gray smaller right' %>
</form>
</div>
<table class="ls-table">
<thead>
<tr>
<th>Nome do usuário</th>
<th class="ls-txt-center hidden-xs">Status</th>
<th class="ls-txt-center">Envios disponíveis</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="#">João da Silva</a>
<span class="ls-tag hidden-xs">Curador</span>
</td>
<td class="ls-txt-center hidden-xs">Ativo</td>
<td class="ls-txt-center">
100.000
<small class="ls-display-block">até 01/01/2014</small>
</td>
<td class="ls-txt-right ls-regroup">
<a href="#" class="ls-btn ls-btn-sm" aria-expanded="false" role="combobox">Administrar</a>
<div data-ls-module="dropdown" class="ls-dropdown ls-pos-right">
<a href="#" class="ls-btn ls-btn-sm" aria-expanded="false" role="combobox"></a>
<ul class="ls-dropdown-nav" aria-hidden="true">
<li><a href="#" role="option">Desativar</a></li>
<li><a href="#" class="ls-color-danger" role="option">Excluir</a></li>
</ul>
</div>
</td>
</tr>
<tr>
<td>
<a href="#">João da Silva</a>
</td>
<td class="ls-txt-center hidden-xs">Ativo</td>
<td class="ls-txt-center">
100.000
<small class="ls-display-block">até 01/01/2014</small>
</td>
<td class="ls-txt-right ls-regroup">
<a href="#" class="ls-btn ls-btn-sm" aria-expanded="false" role="combobox">Administrar</a>
<div data-ls-module="dropdown" class="ls-dropdown ls-pos-right">
<a href="#" class="ls-btn ls-btn-sm" aria-expanded="false" role="combobox"></a>
<ul class="ls-dropdown-nav" aria-hidden="true">
<li><a href="#" role="option">Desativar</a></li>
<li><a href="#" class="ls-color-danger" role="option">Excluir</a></li>
</ul>
</div>
</td>
</tr>
<tr>
<td>
<a href="/locawebstyle/documentacao/exemplos/painel1/client">João da Silva</a>
<span class="ls-tag hidden-xs">Curador</span>
</td>
<td class="ls-txt-center hidden-xs">Ativo</td>
<td class="ls-txt-center">
100.000
<small class="ls-display-block">até 01/01/2014</small>
</td>
<td class="ls-txt-right ls-regroup">
<a href="/locawebstyle/documentacao/exemplos/painel1/client" class="ls-btn ls-btn-sm" aria-expanded="false" role="combobox">Administrar</a>
<div data-ls-module="dropdown" class="ls-dropdown ls-pos-right">
<a href="#" class="ls-btn ls-btn-sm" aria-expanded="false" role="combobox"></a>
<ul class="ls-dropdown-nav" aria-hidden="true">
<li><a href="#" role="option">Desativar</a></li>
<li><a href="#" class="ls-color-danger" role="option">Excluir</a></li>
</ul>
</div>
</td>
</tr>
<tr>
<td>
<a href="/locawebstyle/documentacao/exemplos/painel1/client">João da Silva</a>
</td>
<td class="ls-txt-center hidden-xs">Ativo</td>
<td class="ls-txt-center">
100.000
<small class="ls-display-block">até 01/01/2014</small>
</td>
<td class="ls-txt-right ls-regroup">
<a href="/locawebstyle/documentacao/exemplos/painel1/client" class="ls-btn ls-btn-sm" aria-expanded="false" role="combobox">Administrar</a>
<div data-ls-module="dropdown" class="ls-dropdown ls-pos-right">
<a href="#" class="ls-btn ls-btn-sm" aria-expanded="false" role="combobox"></a>
<ul class="ls-dropdown-nav" aria-hidden="true">
<li><a href="#" role="option">Desativar</a></li>
<li><a href="#" class="ls-color-danger" role="option">Excluir</a></li>
</ul>
</div>
</td>
</tr>
<tr>
<td>
<a href="/locawebstyle/documentacao/exemplos/painel1/client">João da Silva</a>
<span class="ls-tag hidden-xs">Curador</span>
</td>
<td class="ls-txt-center hidden-xs">Ativo</td>
<td class="ls-txt-center">
100.000
<small class="ls-display-block">até 01/01/2014</small>
</td>
<td class="ls-txt-right ls-regroup">
<a href="/locawebstyle/documentacao/exemplos/painel1/client" class="ls-btn ls-btn-sm" aria-expanded="false" role="combobox">Administrar</a>
<div data-ls-module="dropdown" class="ls-dropdown ls-pos-right">
<a href="#" class="ls-btn ls-btn-sm" aria-expanded="false" role="combobox"></a>
<ul class="ls-dropdown-nav" aria-hidden="true">
<li><a href="#" role="option">Desativar</a></li>
<li><a href="#" class="ls-color-danger" role="option">Excluir</a></li>
</ul>
</div>
</td>
</tr>
</tbody>
</table>
<div class="ls-pagination-filter">
<ul class="ls-pagination">
<li><a href="#">« Anterior</a></li>
<li class="ls-active"><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#" class="hidden-xs">4</a></li>
<li><a href="#" class="hidden-xs">5</a></li>
<li><a href="#">Próximo »</a></li>
</ul>
<div class="ls-filter-view">
<label for="">
Exibir
<div class="ls-custom-select ls-field-sm">
<select name="" id="">
<option value="10">10</option>
<option value="30">30</option>
<option value="50">50</option>
<option value="100">100</option>
</select>
</div>
ítens por página
</label>
</div>
</div>
</div>
......@@ -12,7 +12,6 @@ set :branch, 'master'
set :user, 'portalmec'
task :environment do
#invoke :'rbenv:load'
end
task deploy: :environment do
......@@ -31,4 +30,4 @@ task deploy: :environment do
queue %[echo "----------> Pre compiling assets"]
execute 'bundle exec rake assets:precompile'
end
end
end
\ No newline at end of file
......@@ -3,15 +3,18 @@ development: &development
database: PortalMEC
username: admin
password: admin
port: 2480
test:
host: mecdb2.c3sl.ufpr.br
database: PortalMEC
username: admin
password: admin
port: 2480
production:
host: mecdb2.c3sl.ufpr.br
database: PortalMEC
username: admin
password: admin
\ No newline at end of file
password: admin
port: 2480
\ No newline at end of file
Rails.application.routes.draw do
resources :universities
resources :countries
resources :users
resources :highlights, :only => [:new, :create]
match '/highlights' => 'highlights#create', :via => :post
namespace :management do
root 'welcome#index'
post 'highlights/create'
post 'highlights/destroy'
end
root 'welcome#index'
get 'stats/', to: 'management/estatisticas#index', as: 'management_estatisticas_index'
get 'stats/usuarios/' => 'management/estatisticas#usuarios'
get 'stats/colecoes' => 'management/estatisticas#colecoes'
get 'stats/acessos' => 'management/estatisticas#acessos'
get 'stats/downloads' => 'management/estatisticas#downloads'
#get 'management/estatisticas/' => 'management#estatisticas'
#get 'reports' => 'management#denuncias'
resource :users
resources :highlights
end
root 'welcome#index'
get 'management/estatisticas/', to: 'management/estatisticas#index', as: 'management_estatisticas_index'
get 'management/estatisticas/usuarios/' => 'management/estatisticas#usuarios'
get 'management/estatisticas/colecoes' => 'management/estatisticas#colecoes'
get 'management/estatisticas/acessos' => 'management/estatisticas#acessos'
get 'management/estatisticas/downloads' => 'management/estatisticas#downloads'
get 'management/denuncias' => 'management#denuncias'
get 'management/users', to:'management/users#index', as: 'management_users_index'
get 'management/destaques', to: 'management/highlights#index', as: 'management_highlights_index'
get 'management/destaques/new', to: 'management/highlights#new', as: 'management_highlights_new'
get 'management/destaques/delete', to: 'management/highlights#delete', as: 'management_highlights_delete'
get '/faq' => 'welcome#faq'
get '/contato' => 'welcome#contact', as: 'contact'
get '/denuncia' => 'welcome#complaint', as: 'complaint'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment