diff --git a/app/controllers/management/estatisticas_controller.rb b/app/controllers/management/stats_controller.rb similarity index 97% rename from app/controllers/management/estatisticas_controller.rb rename to app/controllers/management/stats_controller.rb index dfbd3d1b192d99e6f7d3c6f58bc60be0820fe1ab..e438bdffb71934010d01c1e3c0ef704509a42cf7 100644 --- a/app/controllers/management/estatisticas_controller.rb +++ b/app/controllers/management/stats_controller.rb @@ -1,4 +1,4 @@ -class Management::EstatisticasController < ManagementController +class Management::StatsController < ManagementController def index g = Gruff::Line.new g.title = "Usuários" diff --git a/app/controllers/management/users_controller.rb b/app/controllers/management/users_controller.rb index 36201b8cd81d50ba8b9f0a30feca04df17787ff6..d51d94c02b1312f3450ebf182854394dcc9e9833 100644 --- a/app/controllers/management/users_controller.rb +++ b/app/controllers/management/users_controller.rb @@ -1,7 +1,73 @@ 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 diff --git a/app/views/management/estatisticas/acessos.html.erb b/app/views/management/stats/acessos.html.erb similarity index 100% rename from app/views/management/estatisticas/acessos.html.erb rename to app/views/management/stats/acessos.html.erb diff --git a/app/views/management/estatisticas/colecoes.html.erb b/app/views/management/stats/colecoes.html.erb similarity index 100% rename from app/views/management/estatisticas/colecoes.html.erb rename to app/views/management/stats/colecoes.html.erb diff --git a/app/views/management/estatisticas/downloads.html.erb b/app/views/management/stats/downloads.html.erb similarity index 100% rename from app/views/management/estatisticas/downloads.html.erb rename to app/views/management/stats/downloads.html.erb diff --git a/app/views/management/estatisticas/index.html.erb b/app/views/management/stats/index.html.erb similarity index 97% rename from app/views/management/estatisticas/index.html.erb rename to app/views/management/stats/index.html.erb index fa5e834122e8e022603a60ae5a6dd6ed07fc7515..e1ffd128f26d7c6aaceb25e051ccfba107bf69a3 100644 --- a/app/views/management/estatisticas/index.html.erb +++ b/app/views/management/stats/index.html.erb @@ -1,12 +1,8 @@ +<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"> diff --git a/app/views/management/estatisticas/test.png b/app/views/management/stats/test.png similarity index 100% rename from app/views/management/estatisticas/test.png rename to app/views/management/stats/test.png diff --git a/app/views/management/estatisticas/usuarios.html.erb b/app/views/management/stats/usuarios.html.erb similarity index 100% rename from app/views/management/estatisticas/usuarios.html.erb rename to app/views/management/stats/usuarios.html.erb diff --git a/app/views/management/users/index.html.erb b/app/views/management/users/index.html.erb index c9bf8dfb50dc7faf3fc1e1fbe474c3cfa8636078..d74dd42c54054e6c9de97392065323634a2596da 100644 --- a/app/views/management/users/index.html.erb +++ b/app/views/management/users/index.html.erb @@ -1,14 +1,186 @@ -<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> diff --git a/config/deploy.rb b/config/deploy.rb index bb8a24112c0d802fbedeeb3149bfd6858e23e380..7322170f505353b05ae2f2616238ea7dcc43c06a 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -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 diff --git a/config/orient_db.yml b/config/orient_db.yml index 502d9c5ccd0fa1bdd2ec5113821e7afea0ecf16e..18387411a39310fee3aed3951a89d7532a0e90a4 100644 --- a/config/orient_db.yml +++ b/config/orient_db.yml @@ -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 diff --git a/config/routes.rb b/config/routes.rb index bf222848a97dac519ba60251aa3ebc3348cc2373..8c5fc4f7cc5772245097d66e4c39e94f8106987b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,33 +1,24 @@ 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'