diff --git a/.travis.yml b/.travis.yml index f9bf584..cdb33fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,5 +7,7 @@ rvm: env: DATABASE_URL=postgres://postgres@localhost/timeoverflow_test before_script: - bundle exec rake db:setup + # allow elasticsearch to be ready - https://docs.travis-ci.com/user/database-setup/#ElasticSearch + - sleep 10 services: - elasticsearch diff --git a/Cloudfile b/Cloudfile deleted file mode 100644 index c259b7a..0000000 --- a/Cloudfile +++ /dev/null @@ -1,20 +0,0 @@ -timeoverflow: - ruby_version: 2.2.2 - environment: production # RAILS_ENV - monitoring_email: saverio.trioni@gmail.com - domains: - - timeoverflow.shellyapp.com - - www.timeoverflow.org - servers: - app1: - size: small - thin: 4 - # delayed_job: 1 - # sidekiq: 1 - # clockwork: on - whenever: on - # elasticsearch: on - databases: - - postgresql - # - mongodb - # - redis diff --git a/Gemfile b/Gemfile index 0881886..853c586 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,5 @@ source 'https://rubygems.org' +ruby '2.3.0' gem 'rails', '4.2.5.2' gem 'rails-i18n' @@ -11,7 +12,6 @@ gem 'pundit' gem 'pg', '0.17.1' gem 'hstore_translate' gem 'dalli' -gem 'slim-rails' # much better than haml gem 'devise', '3.5.6' gem "http_accept_language" gem 'thin' @@ -19,13 +19,11 @@ gem 'unicorn' gem 'foreman' gem 'dotenv-rails' gem 'kaminari' -gem "haml-rails" gem "simple_form", ">= 3.0.0" gem "awesome_print" gem 'memcachier' gem 'rollbar', '2.8.3' gem 'travis-lint' -gem "shelly-dependencies" gem 'whenever', :require => false gem 'prawn' gem 'prawn-table' diff --git a/Gemfile.lock b/Gemfile.lock index 685eafa..be199bb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -153,27 +153,13 @@ GEM formtastic_i18n (0.1.1) globalid (0.3.6) activesupport (>= 4.1.0) - haml (4.1.0.beta.1) - tilt - haml-rails (0.6.0) - actionpack (>= 4.0.1) - activesupport (>= 4.0.1) - haml (>= 3.1, < 5.0) - html2haml (>= 1.0.1) - railties (>= 4.0.1) has_scope (0.6.0) actionpack (>= 3.2, < 5) activesupport (>= 3.2, < 5) hashie (3.4.1) high_voltage (2.1.0) - hpricot (0.8.6) hstore_translate (1.0.0) activerecord (>= 3.1.0) - html2haml (1.0.1) - erubis (~> 2.7.0) - haml (>= 4.0.0.rc.1) - hpricot (~> 0.8.6) - ruby_parser (~> 3.1.1) http_accept_language (2.0.2) i18n (0.7.0) inherited_resources (1.6.0) @@ -298,8 +284,6 @@ GEM rainbow (>= 1.99.1, < 3.0) ruby-progressbar (~> 1.4) ruby-progressbar (1.7.1) - ruby_parser (3.1.3) - sexp_processor (~> 4.1) sass (3.4.21) sass-rails (5.0.4) railties (>= 4.0.0, < 5.0) @@ -309,10 +293,6 @@ GEM tilt (>= 1.1, < 3) select2-rails (4.0.1) thor (~> 0.14) - sexp_processor (4.4.4) - shelly-dependencies (0.2.4) - rake - thin shoulda (3.5.0) shoulda-context (~> 1.0, >= 1.0.1) shoulda-matchers (>= 1.4.1, < 3.0) @@ -322,15 +302,6 @@ GEM simple_form (3.1.0) actionpack (~> 4.0) activemodel (~> 4.0) - slim (3.0.3) - temple (~> 0.7.3) - tilt (>= 1.3.3, < 2.1) - slim-rails (3.0.1) - actionmailer (>= 3.1, < 5.0) - actionpack (>= 3.1, < 5.0) - activesupport (>= 3.1, < 5.0) - railties (>= 3.1, < 5.0) - slim (~> 3.0) sprockets (3.5.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -341,7 +312,6 @@ GEM sshkit (1.8.1) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) - temple (0.7.5) thin (1.6.3) daemons (~> 1.0, >= 1.0.9) eventmachine (~> 1.0) @@ -398,7 +368,6 @@ DEPENDENCIES fabrication faker foreman - haml-rails has_scope high_voltage (~> 2.1.0) hstore_translate @@ -423,10 +392,8 @@ DEPENDENCIES rubocop sass-rails (~> 5.0.1) select2-rails - shelly-dependencies shoulda (>= 3.5) simple_form (>= 3.0.0) - slim-rails thin travis-lint uglifier (= 2.7.2) diff --git a/README.md b/README.md index 9df5cef..b475400 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,7 @@ [![Code Climate](https://codeclimate.com/github/timeoverflow/timeoverflow/badges/gpa.svg)](https://codeclimate.com/github/timeoverflow/timeoverflow) [![Dependencies](https://gemnasium.com/coopdevs/timeoverflow.svg)](https://gemnasium.com/coopdevs/timeoverflow) -:bank: :hourglass: Sistema de Banco de Tiempo. - -Mira la nueva página de TimeOverflow: +:bank: :hourglass: Sistema de gestión de Banco de Tiempo. [Saber más sobre Bancos de Tiempo](http://www.bdtonline.org/) TimeOverflow es un software desarrollado de manera altruista para ofrecer un sistema que facilite la interacción de los miembros y la gestión de los Bancos de Tiempo. El modelo sobre el que se trabaja está guiado por las necesidades de los Bancos de Tiempo @@ -15,7 +13,7 @@ con tres niveles de privilegios: superadmin, admin (solo gestiona un Banco) y mi TimeOverflow está dividido en 2 grandes bloques: -* **Sistema de gestión** +* **Sistema de gestión para los administradores** * **Red social y banca on-line para los usuarios** > **NOTA** Un Banco de Tiempo físico puede funcionar solo con el bloque de gestión, podría ocurrir, por ejemplo, que la inmensa mayoria de sus miembros no usen Internet y podrían querer funcionar solo con listados, cheques y una oficina de gestión. @@ -36,13 +34,15 @@ así como poder publicar anuncios de ofertas/demandas explicados en detalle. Por otro lado los miembros pueden pagarse los servicios de manera virtual para ahorrarse el paso por la oficina del Banco de Tiempo y también tienen la posibilidad de consultar el extracto de su cuenta. -## Notas para desarrollo +# Contribuciones -Únete al equipo de colaboradores!! Gestionamos las tareas en Redbooth.com +## Únete al equipo de colaboradores!! -Si quieres probar la plataforma en local, necesitas PostgreSQL y ruby en sus últimas versiones. +Entra en nuestro Discourse y saludanos ;) [community.coopdevs.org](http://community.coopdevs.org/) -Para más información visita la guia para empezar a desarrollar para timeoverflow en https://github.com/coopdevs/timeoverflow/wiki/Getting-started +Los viernes nos encuentras en Freenode IRC [#coopdevs](https://webchat.freenode.net/?channels=coopdevs) + +Visita [la guia para empezar a desarrollar para timeoverflow](https://github.com/coopdevs/timeoverflow/wiki/Getting-started) ## License diff --git a/app/assets/javascripts/app/app.js.coffee b/app/assets/javascripts/app/app.js.coffee index 4771fd0..bee55ff 100644 --- a/app/assets/javascripts/app/app.js.coffee +++ b/app/assets/javascripts/app/app.js.coffee @@ -39,10 +39,6 @@ angular.module('timeoverflow').controller 'UserListCtrl', ["$scope", "$modal", " # override this in a view where the organizations are needed angular.module('timeoverflow').value 'Organizations', [] -angular.module('timeoverflow').controller 'OrganizationListCtrl', ["$scope", "Organizations", ($scope, Organizations) -> - $scope.organizations = Organizations -] - angular.module('timeoverflow').filter 'timeBalance', -> (seconds) -> if seconds isnt 0 diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 5da07f0..99468ca 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -7,6 +7,11 @@ $navs-bg-color: #080808; $white: #ffffff; $border: #e1e8ed; +[ng-cloak], +.ng-cloak { + visibility: hidden !important; +} + body[data-action="devise/sessions-new"], body[data-action="devise/sessions-create"] { background: image-url('red.jpg') no-repeat center center fixed; background-size: cover; @@ -45,8 +50,13 @@ body[data-action="devise/sessions-new"], body[data-action="devise/sessions-creat } -.post-description { - white-space: pre-line; +.break-word { + word-wrap: break-word; +} + +.post-description img { + float: left; + max-width: 60%; } #new_transfer { @@ -120,6 +130,10 @@ table.users { margin-bottom: 20px; margin-top: 0; } + + img { + max-width: 100%; + } } } @@ -212,5 +226,10 @@ label[required]::after{ .navbar-form { padding: 0; + background-color: transparent; } +form .checkbox input[type="checkbox"] { + margin-left: 5px; + position: relative; +} diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 34bd4d0..5d6b5d1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -58,6 +58,15 @@ module ApplicationHelper html.html_safe end + # Use as <%= markdown content %> or <%= m content %> + # Content can be nil, in that case + # it will be the same as an empty string. + def markdown(content) + RDiscount.new(content || ''.freeze).to_html.html_safe + end + + alias m markdown + # Green or red CSS class depending on whether # positive or negative amount def green_red(amount) diff --git a/app/views/admin/csv/upload_csv.html.erb b/app/views/admin/csv/upload_csv.html.erb new file mode 100644 index 0000000..619fab9 --- /dev/null +++ b/app/views/admin/csv/upload_csv.html.erb @@ -0,0 +1,23 @@ +<%= form_for :dump, url: { action: "import_csv" }, html: { multipart: true, class: "formtastic user" } do |f| %> +
+
    +
  1. + <%= label_tag I18n.t("active_admin.users.upload_csv") %> + <%= f.file_field :file %> +
  2. +
+
    +
  1. + <%= label_tag I18n.t("active_admin.users.organization") %> + <%= f.select :organization_id, options_for_select(Organization.all.map{ |org| [org.name, org.id] }), include_blank: true %> +
  2. +
+
+
+
    +
  1. + <%= f.submit I18n.t("global.save") %> +
  2. +
+
+<% end %> diff --git a/app/views/admin/csv/upload_csv.html.haml b/app/views/admin/csv/upload_csv.html.haml deleted file mode 100644 index 64f6063..0000000 --- a/app/views/admin/csv/upload_csv.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -= form_for :dump, url: {action: "import_csv"}, html: { :multipart => true, class: "formtastic user"} do |f| - %fieldset.inputs - %ol - %li.string.input.optional.stringish - = label_tag I18n.t("active_admin.users.upload_csv") - = f.file_field :file - %ol - %li.string.input.optional.stringish - = label_tag I18n.t("active_admin.users.organization") - = f.select :organization_id, options_for_select(Organization.all.map{ |org| [org.name, org.id] }), include_blank: true - - %fieldset.actions - %ol - %li.action.input_action - = f.submit I18n.t("global.save") diff --git a/app/views/application/_navbar.html.erb b/app/views/application/_navbar.html.erb new file mode 100644 index 0000000..9355c22 --- /dev/null +++ b/app/views/application/_navbar.html.erb @@ -0,0 +1,48 @@ + diff --git a/app/views/application/_navbar.html.haml b/app/views/application/_navbar.html.haml deleted file mode 100644 index c5a2fec..0000000 --- a/app/views/application/_navbar.html.haml +++ /dev/null @@ -1,157 +0,0 @@ -%nav.navbar.navbar-static-top.navbar-inverse{role: :navigation} - .container - .navbar-header - %a.navbar-brand(href="/") TimeOverflow - - %ul.nav.navbar-nav - - if current_user && current_organization - - [User, Offer, Inquiry].each do |item| - - path = item == Offer ? dashboard_offers_path : - - send("#{item.to_s.downcase.pluralize}_path") - %li{class: current_page?(path) && "active"} - %a{href: path} - = glyph(item) - = item.model_name.human(count: :many) - - - if current_user.manages? current_organization - %li.dropdown - %a.dropdown-toggle{ href: "#"} - = glyph("paperclip") - = t ".reports" - %b.caret - %ul.dropdown-menu{role: :menu} - %li - %a{ href: "/report/user_list", data: { popup: true } } - %span.glyphicon.glyphicon-list-alt - = User.model_name.human(count: :many) - %li - %a{ href: "/report/offer_list", data: { popup: true } } - %span.glyphicon.glyphicon-list-alt - = Offer.model_name.human(count: :many) - %li - %a{ href: "/report/inquiry_list", data: { popup: true } } - %span.glyphicon.glyphicon-list-alt - = Inquiry.model_name.human(count: :many) - %li.dropdown - %a.dropdown-toggle{href: "#"} - = glyph("stats") - = t ".statistics" - %b.caret - %ul.dropdown-menu{role: :menu} - %li - %a{href: "/statistics/statistics_global_activity"} - %span.glyphicon.glyphicon-stats - = t ".global_activity" - %li - %a{href: "/statistics/statistics_inactive_users"} - %span.glyphicon.glyphicon-stats - = t ".inactive_users" - %li - %a{href: "/statistics/statistics_demographics"} - %span.glyphicon.glyphicon-stats - = t ".demographics" - %li - %a{href: "/statistics/statistics_last_login"} - %span.glyphicon.glyphicon-stats - = t ".last_login" - %li - %a{href: "/statistics/statistics_without_offers"} - %span.glyphicon.glyphicon-stats - = t ".without_offers" - %li - %a{:href => "/statistics/statistics_type_swaps"} - %span.glyphicon.glyphicon-stats - = t ".type_of_swaps" - %li - %a{:href => "/statistics/statistics_all_transfers"} - %span.glyphicon.glyphicon-stats - = t ".statistics_all_transfers" - %li.dropdown - %a.dropdown-toggle{ href: "#"} - = glyph("wrench") - = t ".admin" - %b.caret - %ul.dropdown-menu{role: :menu} - %li - - path = alpha_grouped_index_tags_path(post_type: "offer") - %a{href: path } - = glyph("tags") - = t ".tags" - %li - - path = offers_path(org: current_organization) - %a{href: path } - = glyph("link") - = glyph("eye-open") - = t ".offer_public_link" - %li - - path = inquiries_path(org: current_organization) - %a{href: path } - = glyph("link") - = glyph("eye-open") - = t ".inquiry_public_link" - - else - - path = alpha_grouped_index_tags_path(post_type: "offer") - %li{class: current_page?(path) && "active"} - %a{href: path} - = glyph("tags") - = t ".tags" - - %ul.nav.navbar-nav.navbar-right - - if current_user - %li.dropdown - %a.dropdown-toggle{href: "#"} - = image_tag avatar_url(current_user), style: "margin: -8px auto" - = current_user.email - %b.caret - %ul.dropdown-menu{role: :menu} - - if superadmin? - %li{role: :presentation} - = link_to admin_root_path do - = glyph(:cog) - = t ".adminshort" - - %li{role: :presentation} - = link_to destroy_user_session_path, method: :delete do - = glyph("log-out") - = t ".sign_out" - %li.divider{role: :presentation} - - if current_user.organizations.count > 1 - - current_user.organizations.each do |org| - - if current_organization == org - %li.disabled - = link_to org.name, "#" - - else - %li - = link_to set_current_organization_path(org), method: :post do - = glyph(:retweet) - = org.name - %li.divider{role: :presentation} - %li{role: :presentation} - = link_to current_user do - = glyph(:user) - = t "layouts.application.edit_profile" - - current_user.members.where(manager: true).each do |m| - %li{role: :presentation} - = link_to m.organization do - = glyph(:pencil) - = t "layouts.application.edit_org", - organization: m.organization - - else - %li - = link_to page_path("about") do - = t "layouts.application.about" - %li - %a{href: new_user_session_path} - = t "layouts.application.login" - - %li.divider{role: :presentation} - - %li.dropdown - %a.dropdown-toggle{ href: "#"} - = glyph("globe") - %b.caret - %ul.dropdown-menu{role: :menu} - %li.disabled - = link_to t("global.locales_header"), "#" - %li.divider - - languages_list diff --git a/app/views/application/_organization_list.html.erb b/app/views/application/_organization_list.html.erb new file mode 100644 index 0000000..e85c22b --- /dev/null +++ b/app/views/application/_organization_list.html.erb @@ -0,0 +1,31 @@ +
+

+ <%= t "application.organization_list.welcome", user: current_user.to_s %> +
+ <%= t "application.organization_list.not_member" %> +

+ + + + + + + + + + + + + <% Organization.find_each do |org| %> + + + + + + + + + <% end %> + +
<%= t "application.organization_list.time_bank" %><%= t "application.organization_list.email" %><%= t "application.organization_list.phone" %><%= t "application.organization_list.public_opening_times" %><%= t "application.organization_list.city" %><%= t "application.organization_list.neighborhood" %>
<%= org.name %><%= org.email %><%= org.phone %><%= org.public_opening_times %><%= org.city %><%= org.neighborhood %>
+
diff --git a/app/views/application/_organization_list.html.haml b/app/views/application/_organization_list.html.haml deleted file mode 100644 index 623a78d..0000000 --- a/app/views/application/_organization_list.html.haml +++ /dev/null @@ -1,33 +0,0 @@ -:javascript - angular.module('timeoverflow').value('Organizations', #{ raw Organization.all.to_json(only: [:name, :email, :phone, :public_opening_times, :city, :neighborhood]) }); - - -.jumbotron{"ng-controller" => "OrganizationListCtrl"} - %p.lead - = t(".welcome", user: current_user.to_s) - %br/ - = t(".not_member") - - %table.table - %thead - %tr - %th - =t(".time_bank") - %th - =t(".email") - %th - =t(".phone") - %th - =t(".public_opening_times") - %th - =t(".city") - %th - =t(".neighborhood") - %tbody - %tr{"ng-repeat" => "org in organizations"} - %td {{ org.name }} - %td {{ org.email }} - %td {{ org.phone }} - %td {{ org.public_opening_times }} - %td {{ org.city }} - %td {{ org.neighborhood }} diff --git a/app/views/application/menus/_inquiries_list_link.html.erb b/app/views/application/menus/_inquiries_list_link.html.erb new file mode 100644 index 0000000..3076be0 --- /dev/null +++ b/app/views/application/menus/_inquiries_list_link.html.erb @@ -0,0 +1,6 @@ +
  • "> + <%= link_to inquiries_path do %> + <%= glyph :inquiry %> + <%= Inquiry.model_name.human(count: :many) %> + <% end %> +
  • diff --git a/app/views/application/menus/_language_switcher.html.erb b/app/views/application/menus/_language_switcher.html.erb new file mode 100644 index 0000000..a7dc08c --- /dev/null +++ b/app/views/application/menus/_language_switcher.html.erb @@ -0,0 +1,17 @@ + diff --git a/app/views/application/menus/_offers_by_tag_link.html.erb b/app/views/application/menus/_offers_by_tag_link.html.erb new file mode 100644 index 0000000..585b150 --- /dev/null +++ b/app/views/application/menus/_offers_by_tag_link.html.erb @@ -0,0 +1,6 @@ +
  • "> + <%= link_to alpha_grouped_index_tags_path(post_type: "offer") do %> + <%= glyph :tags %> + <%= t ".tags" %> + <% end %> +
  • diff --git a/app/views/application/menus/_offers_dashboard_link.html.erb b/app/views/application/menus/_offers_dashboard_link.html.erb new file mode 100644 index 0000000..54d38e0 --- /dev/null +++ b/app/views/application/menus/_offers_dashboard_link.html.erb @@ -0,0 +1,6 @@ +
  • "> + <%= link_to dashboard_offers_path do %> + <%= glyph :offer %> + <%= Offer.model_name.human(count: :many) %> + <% end %> +
  • diff --git a/app/views/application/menus/_organization_listings_menu.html.erb b/app/views/application/menus/_organization_listings_menu.html.erb new file mode 100644 index 0000000..6ea4ba6 --- /dev/null +++ b/app/views/application/menus/_organization_listings_menu.html.erb @@ -0,0 +1,29 @@ + diff --git a/app/views/application/menus/_organization_reports_menu.html.erb b/app/views/application/menus/_organization_reports_menu.html.erb new file mode 100644 index 0000000..74cdc82 --- /dev/null +++ b/app/views/application/menus/_organization_reports_menu.html.erb @@ -0,0 +1,27 @@ + diff --git a/app/views/application/menus/_organization_statistics_menu.html.erb b/app/views/application/menus/_organization_statistics_menu.html.erb new file mode 100644 index 0000000..72857f3 --- /dev/null +++ b/app/views/application/menus/_organization_statistics_menu.html.erb @@ -0,0 +1,51 @@ + diff --git a/app/views/application/menus/_organization_switcher.html.erb b/app/views/application/menus/_organization_switcher.html.erb new file mode 100644 index 0000000..10d3ca0 --- /dev/null +++ b/app/views/application/menus/_organization_switcher.html.erb @@ -0,0 +1,11 @@ +
  • + <%= current_organization.name %> +
  • +<% (current_user.organizations - [current_organization]).each do |org| %> +
  • + <%= link_to set_current_organization_path(org), method: :post do %> + <%= glyph(:retweet) %> + <%= org.name %> + <% end %> +
  • +<% end %> diff --git a/app/views/application/menus/_user_admin_menu.html.erb b/app/views/application/menus/_user_admin_menu.html.erb new file mode 100644 index 0000000..58f3940 --- /dev/null +++ b/app/views/application/menus/_user_admin_menu.html.erb @@ -0,0 +1,42 @@ + diff --git a/app/views/application/menus/_user_list_link.html.erb b/app/views/application/menus/_user_list_link.html.erb new file mode 100644 index 0000000..e3bf2c4 --- /dev/null +++ b/app/views/application/menus/_user_list_link.html.erb @@ -0,0 +1,6 @@ +
  • "> + <%= link_to users_path do %> + <%= glyph :user %> + <%= User.model_name.human(count: :many) %> + <% end %> +
  • diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise/confirmations/new.html.erb new file mode 100644 index 0000000..34c9f45 --- /dev/null +++ b/app/views/devise/confirmations/new.html.erb @@ -0,0 +1,26 @@ +
    +
    + <%= render "devise/shared/links" %> +
    +
    +
    +
    +

    + <%= t(".resend_instructions") %> +

    +
    +
    + <%= show_error_messages!(resource) %> + <%= form_for resource, url: confirmation_path(resource_name), html: { method: :post } do |f| %> +
    + <%= f.label :email, class: "control-label" %> + <%= f.text_field :email, required: true, autofocus: true, class: "form-control" %> +
    +
    + <%= f.submit t(".resend_instructions"), class: "btn btn-primary" %> +
    + <% end %> +
    +
    +
    +
    diff --git a/app/views/devise/confirmations/new.html.haml b/app/views/devise/confirmations/new.html.haml deleted file mode 100644 index 6c2a74c..0000000 --- a/app/views/devise/confirmations/new.html.haml +++ /dev/null @@ -1,17 +0,0 @@ -.row - .col-sm-4 - = render "devise/shared/links" - .col-sm-8 - .panel.panel-primary - .panel-heading - %h2.panel-title - = t(".resend_instructions") - - .panel-body - = show_error_messages!(resource) - = form_for resource, url: confirmation_path(resource_name), html: { method: :post } do |f| - .form-group - = f.label :email, class: "control-label" - = f.text_field :email, required: true, autofocus: true, class: "form-control" - .form-group - = f.submit t(".resend_instructions"), class: "btn btn-primary" diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb new file mode 100644 index 0000000..288e3f6 --- /dev/null +++ b/app/views/devise/passwords/edit.html.erb @@ -0,0 +1,34 @@ +
    +
    + <%= render "devise/shared/links" %> +
    +
    +
    +
    +

    + <%= t(".change_password") %> +

    +
    +
    + <%= show_error_messages!(resource) %> + <%= form_for resource, url: password_path(resource_name), html: { method: :put } do |f| %> + <%= f.hidden_field :reset_password_token %> +
    + <%= f.label :password, t(".new_password"), class: "control-label" %> + <%= f.password_field :password, required: true, autofocus: true, class: "form-control", ng_model: "password" %> +
    +
    + <%= f.label :password_confirmation, t(".confirm_password"), class: "control-label" %> + <%= f.password_field :password_confirmation, required: true, class: "form-control", ng_model: "password_confirmation" %> +
    + <%= t ".passwords_not_match" %> +
    +
    +
    + <%= f.submit t(".change_password"), class: "btn btn-primary", ng_disabled: "!password || password != password_confirmation" %> +
    + <% end %> +
    +
    +
    +
    diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml deleted file mode 100644 index 7dbf69a..0000000 --- a/app/views/devise/passwords/edit.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -.row - .col-sm-4 - = render "devise/shared/links" - .col-sm-8 - .panel.panel-primary - .panel-heading - %h2.panel-title - = t(".change_password") - - .panel-body - = show_error_messages!(resource) - = form_for resource, url: password_path(resource_name), html: { method: :put } do |f| - = f.hidden_field :reset_password_token - .form-group - = f.label :password, t(".new_password"), class: "control-label" - = f.password_field :password, required: true, autofocus: true, class: "form-control", ng_model: "password" - .form-group{ ng_class: "{ 'has-error': password != password_confirmation }" } - = f.label :password_confirmation, t(".confirm_password"), class: "control-label" - = f.password_field :password_confirmation, required: true, class: "form-control", ng_model: "password_confirmation" - .help-block{ ng_if: "password && password_confirmation && password != password_confirmation" } - = t ".passwords_not_match" - .form-group - = f.submit t(".change_password"), class: "btn btn-primary", ng_disabled: "!password || password != password_confirmation" diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb new file mode 100644 index 0000000..977e6e1 --- /dev/null +++ b/app/views/devise/passwords/new.html.erb @@ -0,0 +1,26 @@ +
    +
    + <%= render "devise/shared/links" %> +
    +
    +
    +
    +

    + <%= t(".forgot_question") %> +

    +
    +
    + <%= show_error_messages!(resource) %> + <%= form_for resource, url: password_path(resource_name), html: { method: :post } do |f| %> +
    + <%= f.label :email, class: "control-label" %> + <%= f.text_field :email, required: true, autofocus: true, class: "form-control" %> +
    +
    + <%= f.submit t(".send_instructions"), class: "btn btn-primary" %> +
    + <% end %> +
    +
    +
    +
    diff --git a/app/views/devise/passwords/new.html.haml b/app/views/devise/passwords/new.html.haml deleted file mode 100644 index 455aede..0000000 --- a/app/views/devise/passwords/new.html.haml +++ /dev/null @@ -1,17 +0,0 @@ -.row - .col-sm-4 - = render "devise/shared/links" - .col-sm-8 - .panel.panel-primary - .panel-heading - %h2.panel-title - = t(".forgot_question") - - .panel-body - = show_error_messages!(resource) - = form_for resource, url: password_path(resource_name), html: { method: :post } do |f| - .form-group - = f.label :email, class: "control-label" - = f.text_field :email, required: true, autofocus: true, class: "form-control" - .form-group - = f.submit t(".send_instructions"), class: "btn btn-primary" diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb new file mode 100644 index 0000000..e94316c --- /dev/null +++ b/app/views/devise/registrations/edit.html.erb @@ -0,0 +1,60 @@ +
    +
    +
    +
    +

    + <%= t(".edit_user") %> +

    +
    +
    + <%= show_error_messages!(resource) %> + <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> +
    + <%= f.label :email, class: "control-label" %> + <%= f.text_field :email, required: true, autofocus: true, class: "form-control" %> + <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> +

    + Currently waiting confirmation for: + <%= resource.unconfirmed_email %> +

    + <% end %> +
    +
    + <%= f.label t(".password"), class: "control-label" %> + <%= f.password_field :password, required: true, autocomplete: "off", class: "form-control" %> +

    + <%= t(".help_password") %> +

    +
    +
    + <%= f.label t(".password_confirmation"), class: "control-label" %> + <%= f.password_field :password_confirmation, required: true, class: "form-control" %> +
    +
    + <%= f.label t(".current_password"), class: "control-label" %> + <%= f.password_field :current_password, required: true, class: "form-control" %> +

    + <%= t(".help_current_password") %> +

    +
    +
    + <%= f.submit t(".update"), class: "btn btn-primary" %> +
    + <% end %> +
    +
    +
    +
    +

    + <%= t(".cancel_account") %> +

    +
    +
    +

    + <%= t(".unhappy") %> + <%= link_to t(".cancel_account"), registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %> +

    +
    +
    +
    +
    diff --git a/app/views/devise/registrations/edit.html.haml b/app/views/devise/registrations/edit.html.haml deleted file mode 100644 index 1613db2..0000000 --- a/app/views/devise/registrations/edit.html.haml +++ /dev/null @@ -1,41 +0,0 @@ -.row - .col-sm-offset-4.col-sm-8 - .panel.panel-primary - .panel-heading - %h2.panel-title - = t(".edit_user") - .panel-body - = show_error_messages!(resource) - - = form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| - .form-group - = f.label :email, class: "control-label" - = f.text_field :email, required: true, autofocus: true, class: "form-control" - - if devise_mapping.confirmable? && resource.pending_reconfirmation? - %p.help-block - Currently waiting confirmation for: - = resource.unconfirmed_email - .form-group - = f.label t(".password"), class: "control-label" - = f.password_field :password, required: true, autocomplete: "off", class: "form-control" - %p.help-block - = t(".help_password") - .form-group - = f.label t(".password_confirmation"), class: "control-label" - = f.password_field :password_confirmation, required: true, class: "form-control" - .form-group - = f.label t(".current_password"), class: "control-label" - = f.password_field :current_password, required: true, class: "form-control" - %p.help-block - = t(".help_current_password") - .form-group - = f.submit t(".update"), class: "btn btn-primary" - - .panel.panel-primary - .panel-heading - %h2.panel-title - = t(".cancel_account") - .panel-body - %p - = t(".unhappy") - = link_to t(".cancel_account"), registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb new file mode 100644 index 0000000..d6fce85 --- /dev/null +++ b/app/views/devise/registrations/new.html.erb @@ -0,0 +1,38 @@ +
    +
    + <%= render "devise/shared/links" %> +
    +
    +
    +
    +

    + <%= t(".sign_up") %> +

    +
    +
    + <%= show_error_messages!(resource) %> + <%= form_for resource, url: registration_path(resource_name) do |f| %> +
    + <%= f.label :username, class: "control-label" %> + <%= f.text_field :username, required: true, autofocus: true, class: "form-control" %> +
    +
    + <%= f.label :email, class: "control-label" %> + <%= f.text_field :email, required: true, autofocus: true, class: "form-control" %> +
    +
    + <%= f.label t(".password"), class: "control-label" %> + <%= f.password_field :password, required: true, class: "form-control" %> +
    +
    + <%= f.label t(".password_confirmation"), class: "control-label" %> + <%= f.password_field :password_confirmation, required: true, class: "form-control" %> +
    +
    + <%= f.submit t(".sign_me_up"), class: "btn btn-primary" %> +
    + <% end %> +
    +
    +
    +
    diff --git a/app/views/devise/registrations/new.html.haml b/app/views/devise/registrations/new.html.haml deleted file mode 100644 index 5acbf57..0000000 --- a/app/views/devise/registrations/new.html.haml +++ /dev/null @@ -1,26 +0,0 @@ -.row - .col-sm-4 - = render "devise/shared/links" - .col-sm-8 - .panel.panel-primary - .panel-heading - %h2.panel-title - = t(".sign_up") - - .panel-body - = show_error_messages!(resource) - = form_for resource, url: registration_path(resource_name) do |f| - .form-group - = f.label :username, class: "control-label" - = f.text_field :username, required: true, autofocus: true, class: "form-control" - .form-group - = f.label :email, class: "control-label" - = f.text_field :email, required: true, autofocus: true, class: "form-control" - .form-group - = f.label t(".password"), class: "control-label" - = f.password_field :password, required: true, class: "form-control" - .form-group - = f.label t(".password_confirmation"), class: "control-label" - = f.password_field :password_confirmation, required: true, class: "form-control" - .form-group - = f.submit t(".sign_me_up"), class: "btn btn-primary" diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb new file mode 100644 index 0000000..f55235a --- /dev/null +++ b/app/views/devise/sessions/new.html.erb @@ -0,0 +1,55 @@ +
    +
    +
    +
    +

    + <%= glyph :hourglass %> + TimeOverflow +

    +
    +
    + <%= show_error_messages!(resource) %> + <%= form_for resource, url: session_path(resource_name) do |f| %> +
    +
    + + <%= glyph :user %> + + <%= f.text_field :email, required: false, autofocus: true, placeholder: "Email address", class: "form-control input-lg" %> +
    +
    +
    +
    + + <%= glyph :lock %> + + <%= f.password_field :password, required: false, autofocus: true, placeholder: "Password", class: "form-control input-lg" %> +
    +
    +
    +
    +
    +
    + <%= f.label :remember_me do |nada| %> + <%= f.check_box :remember_me %> + <%= t(".remember_me") %> + <% end %> +
    +
    +
    +
    +
    +
    +
    + <%= f.submit t(".sign_in"), class: "btn btn-primary btn-lg col-xs-12" %> +
    +
    +
    + <% end %> +
    + +
    +
    +
    diff --git a/app/views/devise/sessions/new.html.slim b/app/views/devise/sessions/new.html.slim deleted file mode 100644 index 076435c..0000000 --- a/app/views/devise/sessions/new.html.slim +++ /dev/null @@ -1,34 +0,0 @@ -.row - .col-xs-12.col-sm-8.col-sm-offset-2.col-md-6.col-md-offset-3.col-lg-4.col-lg-offset-4 - .panel#login-box - .panel-heading - h1 - span.glyphicon.glyphicon-hourglass - | TimeOverflow - .panel-body - = show_error_messages!(resource) - = form_for resource, url: session_path(resource_name) do |f| - .form-group - .input-group - span.input-group-addon - span.glyphicon.glyphicon-user - = f.text_field :email, required: false, autofocus: true, placeholder: "Email address", class: "form-control input-lg" - .form-group - .input-group - span.input-group-addon - span.glyphicon.glyphicon-lock - = f.password_field :password, required: false, autofocus: true, placeholder: "Password", class: "form-control input-lg" - .form-group#remember-me-wrapper - .row - .col-xs-6 - .checkbox - = f.label :remember_me do |nada| - = f.check_box :remember_me - = t(".remember_me") - .form-group - .row - .col-xs-12 - = f.submit t(".sign_in"), class: "btn btn-primary btn-lg col-xs-12" - - .panel-footer - = render "devise/shared/links" diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise/unlocks/new.html.erb new file mode 100644 index 0000000..ff3d394 --- /dev/null +++ b/app/views/devise/unlocks/new.html.erb @@ -0,0 +1,26 @@ +
    +
    + <%= render "devise/shared/links" %> +
    +
    +
    +
    +

    + <%= t(".resend_instructions") %> +

    +
    +
    + <%= show_error_messages!(resource) %> + <%= form_for resource, url: unlock_path(resource_name), html: { method: :post } do |f| %> +
    + <%= f.label :email, class: "control-label" %> + <%= f.text_field :email, required: false, autofocus: true, class: "form-control" %> +
    +
    + <%= f.submit t(".resend_instructions"), class: "btn btn-primary" %> +
    + <% end %> +
    +
    +
    +
    diff --git a/app/views/devise/unlocks/new.html.haml b/app/views/devise/unlocks/new.html.haml deleted file mode 100644 index f92055c..0000000 --- a/app/views/devise/unlocks/new.html.haml +++ /dev/null @@ -1,17 +0,0 @@ -.row - .col-sm-4 - = render "devise/shared/links" - .col-sm-8 - .panel.panel-primary - .panel-heading - %h2.panel-title - = t(".resend_instructions") - - .panel-body - = show_error_messages!(resource) - = form_for resource, url: unlock_path(resource_name), html: { method: :post } do |f| - .form-group - = f.label :email, class: "control-label" - = f.text_field :email, required: false, autofocus: true, class: "form-control" - .form-group - = f.submit t(".resend_instructions"), class: "btn btn-primary" diff --git a/app/views/documents/show+modal.html.erb b/app/views/documents/show+modal.html.erb new file mode 100644 index 0000000..c6cca66 --- /dev/null +++ b/app/views/documents/show+modal.html.erb @@ -0,0 +1,9 @@ + + diff --git a/app/views/documents/show+modal.html.haml b/app/views/documents/show+modal.html.haml deleted file mode 100644 index 7d99550..0000000 --- a/app/views/documents/show+modal.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -.modal-header - %button.close{type: "button", "data-dismiss" => "modal", "aria-hiden" => "true"} × - %h4.modal-title= @document.title -.modal-body - :markdown - #{@document.content} diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb new file mode 100644 index 0000000..ca5f424 --- /dev/null +++ b/app/views/home/index.html.erb @@ -0,0 +1,63 @@ +
    +
    +
    +
    +

    + <%= glyph :hourglass %> + TimeOverflow +

    +
    +
    +
    +
    +
    + + <%= glyph :user %> + + +
    +
    +
    +
    + + <%= glyph :lock %> + + +
    +
    +
    +
    +
    +
    + + +
    +
    + + <%= t("devise.shared.links.forgot_your_password") %> + +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    diff --git a/app/views/home/index.html.slim b/app/views/home/index.html.slim deleted file mode 100644 index 67be356..0000000 --- a/app/views/home/index.html.slim +++ /dev/null @@ -1,34 +0,0 @@ -.row - .col-xs-12.col-sm-8.col-sm-offset-2.col-md-6.col-md-offset-3.col-lg-4.col-lg-offset-4 - .panel#login-box - .panel-heading - h1 - span.glyphicon.glyphicon-hourglass - | TimeOverflow - .panel-body - form action="index.html" role="form" - .form-group - .input-group - span.input-group-addon - span.glyphicon.glyphicon-user - input.form-control.input-lg placeholder=("Email address") type="text" / - .form-group - .input-group - span.input-group-addon - span.glyphicon.glyphicon-lock - input.form-control.input-lg placeholder="Password" type="password" / - #remember-me-wrapper - .row - .col-xs-6 - .checkbox-nice - input#remember-me checked="checked" type="checkbox" / - label for="remember-me" - | Remember me - a#login-forget-link.col-xs-6 href="forgot-password-full.html" - | Forgot password? - .row - .col-xs-12 - button.btn.btn-success.btn-lg.col-xs-12 type="submit" Login - - .panel-footer - = render "devise/shared/links" diff --git a/app/views/inquiries/edit.html.erb b/app/views/inquiries/edit.html.erb new file mode 100644 index 0000000..759437c --- /dev/null +++ b/app/views/inquiries/edit.html.erb @@ -0,0 +1,5 @@ +

    + <%= @inquiry.title %> + <%= t ".edit" %> +

    +<%= render "shared/post_form", post: @inquiry, label_button: t(".submit") %> diff --git a/app/views/inquiries/edit.html.haml b/app/views/inquiries/edit.html.haml deleted file mode 100644 index 435c6e6..0000000 --- a/app/views/inquiries/edit.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -%h1 - = @inquiry.title - %small - = t ".edit" - -= render partial: "shared/post_form", locals: { post: @inquiry, - label_button: t(".submit") } diff --git a/app/views/inquiries/index.html.erb b/app/views/inquiries/index.html.erb new file mode 100644 index 0000000..4475ff7 --- /dev/null +++ b/app/views/inquiries/index.html.erb @@ -0,0 +1,57 @@ +<% @category = Category.where(id: params[:cat]).first %> +

    + <%= Inquiry.model_name.human(count: :many) %> + <%= render "shared/show_filter_hint" %> +

    + + + +
    + <%= render "shared/posts", posts: @inquiries %> +
    +<%= paginate @inquiries %> diff --git a/app/views/inquiries/index.html.haml b/app/views/inquiries/index.html.haml deleted file mode 100644 index 1d4f1ed..0000000 --- a/app/views/inquiries/index.html.haml +++ /dev/null @@ -1,35 +0,0 @@ -%h1 - - @category = Category.where(id: params[:cat]).first - = Inquiry.model_name.human(count: :many) - = render("/shared/show_filter_hint.html.haml") - -.navbar - %form.navbar-form.navbar-left{action: inquiries_path, role: "search", - method: "get"} - .form-group - %input.form-control{type: "text", placeholder: t("global.search"), - name: "q", value: params[:q]} - %button.btn.btn-default{type: "submit"}= t("global.search") - - %ul.nav.navbar-nav - %li.dropdown - %a.dropdown-toggle{href: "#"} - = @category ? @category.name : Category.model_name.human - %span.caret - %ul.dropdown-menu{role: "menu"} - %li= link_to "× #{t("global.all")}", inquiries_path - - Category.all.sort_by { |a| a.name.downcase }.each do |c| - - next if c == @category - %li= link_to c.name, inquiries_path(cat: c.id) - - - if current_user && current_organization && !params[:org] - %ul.nav.navbar-nav.pull-right - %li - %a{href: new_inquiry_path} - %span.glyphicon.glyphicon-plus - = t "helpers.submit.create", model: Inquiry.model_name.human - -.inquiries - = render partial: "shared/posts", locals: { posts: @inquiries } - -= paginate @inquiries diff --git a/app/views/inquiries/index.js.erb b/app/views/inquiries/index.js.erb new file mode 100644 index 0000000..63a9e9b --- /dev/null +++ b/app/views/inquiries/index.js.erb @@ -0,0 +1,2 @@ +$('.inquiries').append('<%= j render("shared/posts", posts: @inquiries) %>'); +$('.inquiries ~ a[rel=next]').replaceWith('<%= j link_to_next_page(@inquiries, t('.more'), remote: true, params: params) %>'); diff --git a/app/views/inquiries/index.js.haml b/app/views/inquiries/index.js.haml deleted file mode 100644 index af36c7b..0000000 --- a/app/views/inquiries/index.js.haml +++ /dev/null @@ -1,2 +0,0 @@ -$('.inquiries').append('#{escape_javascript(render partial: "shared/posts", :locals => { :posts => @inquiries })}'); -$('.inquiries ~ a[rel=next]').replaceWith('#{link_to_next_page @inquiries, t('.more'), remote: true, params: params}'); diff --git a/app/views/inquiries/new.html.erb b/app/views/inquiries/new.html.erb new file mode 100644 index 0000000..296aace --- /dev/null +++ b/app/views/inquiries/new.html.erb @@ -0,0 +1,4 @@ +

    + <%= t "helpers.submit.create", model: @inquiry.class.model_name.human %> +

    +<%= render 'shared/post_form', post: @inquiry, label_button: t(".submit") %> diff --git a/app/views/inquiries/new.html.haml b/app/views/inquiries/new.html.haml deleted file mode 100644 index 6dbb7c4..0000000 --- a/app/views/inquiries/new.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -%h1= t "helpers.submit.create", model: @inquiry.class.model_name.human - -= render partial: 'shared/post_form', locals: { post: @inquiry , label_button: t(".submit")} diff --git a/app/views/inquiries/show.html.erb b/app/views/inquiries/show.html.erb new file mode 100644 index 0000000..7c1bb7a --- /dev/null +++ b/app/views/inquiries/show.html.erb @@ -0,0 +1,15 @@ +

    + <% if admin? || @inquiry.user == current_user %> + <%= link_to edit_inquiry_path(@inquiry), class: "btn btn-warning" do %> + <%= glyph :pencil %> + <%= t "global.edit" %> + <% end %> + <%= link_to @inquiry, + data: { method: :delete, confirm: "sure?" }, + class: "btn btn-danger" do %> + <%= glyph :trash %> + <%= t "global.delete" %> + <% end %> + <% end %> +

    +<%= render "shared/post", post: @inquiry %> diff --git a/app/views/inquiries/show.html.haml b/app/views/inquiries/show.html.haml deleted file mode 100644 index 1210720..0000000 --- a/app/views/inquiries/show.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -= render "shared/post", post: @inquiry - -%p.actions - - - if admin? or @inquiry.user == current_user - = link_to edit_inquiry_path(@inquiry), class: "btn btn-warning" do - = glyph :pencil - = t "global.edit" - - = link_to @inquiry, data: {method: :DELETE, confirm: "sure?" }, :class => "btn btn-danger" do - = glyph :trash - = t "global.delete" - diff --git a/app/views/kaminari/_first_page.html.erb b/app/views/kaminari/_first_page.html.erb new file mode 100644 index 0000000..bf23ff0 --- /dev/null +++ b/app/views/kaminari/_first_page.html.erb @@ -0,0 +1,3 @@ +
  • + <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %> +
  • diff --git a/app/views/kaminari/_first_page.html.haml b/app/views/kaminari/_first_page.html.haml deleted file mode 100644 index a1bbf18..0000000 --- a/app/views/kaminari/_first_page.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -%li - = link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote diff --git a/app/views/kaminari/_gap.html.erb b/app/views/kaminari/_gap.html.erb new file mode 100644 index 0000000..6d3a149 --- /dev/null +++ b/app/views/kaminari/_gap.html.erb @@ -0,0 +1,3 @@ +
  • + <%= content_tag :a, raw(t 'views.pagination.truncate') %> +
  • diff --git a/app/views/kaminari/_gap.html.haml b/app/views/kaminari/_gap.html.haml deleted file mode 100644 index 606bd83..0000000 --- a/app/views/kaminari/_gap.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -%li.disabled - = content_tag :a, raw(t 'views.pagination.truncate') diff --git a/app/views/kaminari/_last_page.html.erb b/app/views/kaminari/_last_page.html.erb new file mode 100644 index 0000000..fb619ea --- /dev/null +++ b/app/views/kaminari/_last_page.html.erb @@ -0,0 +1,3 @@ +
  • + <%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} %> +
  • diff --git a/app/views/kaminari/_last_page.html.haml b/app/views/kaminari/_last_page.html.haml deleted file mode 100644 index e70697d..0000000 --- a/app/views/kaminari/_last_page.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -%li - = link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} diff --git a/app/views/kaminari/_next_page.html.erb b/app/views/kaminari/_next_page.html.erb new file mode 100644 index 0000000..15e10e4 --- /dev/null +++ b/app/views/kaminari/_next_page.html.erb @@ -0,0 +1,3 @@ +
  • + <%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote %> +
  • diff --git a/app/views/kaminari/_next_page.html.haml b/app/views/kaminari/_next_page.html.haml deleted file mode 100644 index ea9af45..0000000 --- a/app/views/kaminari/_next_page.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -%li - = link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote diff --git a/app/views/kaminari/_page.html.erb b/app/views/kaminari/_page.html.erb new file mode 100644 index 0000000..8028b45 --- /dev/null +++ b/app/views/kaminari/_page.html.erb @@ -0,0 +1,9 @@ +<% if page.current? %> +
  • + <%= content_tag :a, page, remote: remote, rel: (page.next? ? 'next' : (page.prev? ? 'prev' : nil)) %> +
  • +<% else %> +
  • + <%= link_to page, url, remote: remote, rel: (page.next? ? 'next' : (page.prev? ? 'prev' : nil)) %> +
  • +<% end %> diff --git a/app/views/kaminari/_page.html.haml b/app/views/kaminari/_page.html.haml deleted file mode 100644 index b3a4ae2..0000000 --- a/app/views/kaminari/_page.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -- if page.current? - %li.active - = content_tag :a, page, remote: remote, rel: (page.next? ? 'next' : (page.prev? ? 'prev' : nil)) -- else - %li - = link_to page, url, remote: remote, rel: (page.next? ? 'next' : (page.prev? ? 'prev' : nil)) diff --git a/app/views/kaminari/_paginator.html.erb b/app/views/kaminari/_paginator.html.erb new file mode 100644 index 0000000..2c8757b --- /dev/null +++ b/app/views/kaminari/_paginator.html.erb @@ -0,0 +1,15 @@ +<%= paginator.render do -%> + +<% end -%> diff --git a/app/views/kaminari/_paginator.html.haml b/app/views/kaminari/_paginator.html.haml deleted file mode 100644 index 07fdb1e..0000000 --- a/app/views/kaminari/_paginator.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -= paginator.render do - %ul.pagination - = first_page_tag unless current_page.first? - = prev_page_tag unless current_page.first? - - each_page do |page| - - if page.left_outer? || page.right_outer? || page.inside_window? - = page_tag page - - elsif !page.was_truncated? - = gap_tag - = next_page_tag unless current_page.last? - = last_page_tag unless current_page.last? diff --git a/app/views/kaminari/_prev_page.html.erb b/app/views/kaminari/_prev_page.html.erb new file mode 100644 index 0000000..d94a50a --- /dev/null +++ b/app/views/kaminari/_prev_page.html.erb @@ -0,0 +1,3 @@ +
  • + <%= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote %> +
  • diff --git a/app/views/kaminari/_prev_page.html.haml b/app/views/kaminari/_prev_page.html.haml deleted file mode 100644 index dab3b31..0000000 --- a/app/views/kaminari/_prev_page.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -%li - = link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb new file mode 100644 index 0000000..c3689f9 --- /dev/null +++ b/app/views/layouts/application.html.erb @@ -0,0 +1,47 @@ + + + + + + + + <% if content_for? :window_title %> + <%= content_for :window_title %> + <% else %> + <% if current_organization %> + <%= current_organization %> — + <% end %> + <%= yield :title %> + <% end %> + + <%= csrf_meta_tags %> + + <%= stylesheet_link_tag 'libs', media: 'all' %> + <%= stylesheet_link_tag 'application', media: 'all' %> + <%= javascript_include_tag 'libs' %> + <%= javascript_include_tag 'application' %> + + + <%= render 'navbar' %> +
    + <%= render 'layouts/messages' %> + <%= yield %> +
    + + + + diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml deleted file mode 100644 index b7d308d..0000000 --- a/app/views/layouts/application.html.haml +++ /dev/null @@ -1,45 +0,0 @@ -!!! 5 -%html{lang: "en"} - %head - %meta{charset: "utf-8"} - %meta{"http-equiv" => "X-UA-Compatible", content: "IE=Edge,chrome=1"} - %meta{name: "viewport", content: "width=device-width, initial-scale=1.0"} - %title - - if content_for? :window_title - - - = content_for :window_title - - else - - if current_organization - = current_organization - — - = yield :title - - = csrf_meta_tags - - %link{href: "/favicon.ico", rel: "shortcut icon"} - - = stylesheet_link_tag "libs", media: "all" - = stylesheet_link_tag "application", media: "all" - - = javascript_include_tag "libs" - = javascript_include_tag "application" - - %body{ "ng-app" => "timeoverflow", "data-action" => "#{params[:controller]}-#{params[:action]}" } - = render 'navbar' - - .container - = render 'layouts/messages' - = yield - - .modal.fade#modal - .modal-dialog - .modal-content - - #footer - %p - %a{href: tnc_path, "data-toggle" => "modal", "data-target" => "#modal"} - = t("application.terms_conditions") - | - %a - = link_to page_path("about") do - = t "layouts.application.about" diff --git a/app/views/layouts/report.html.erb b/app/views/layouts/report.html.erb new file mode 100644 index 0000000..1f0bd80 --- /dev/null +++ b/app/views/layouts/report.html.erb @@ -0,0 +1,24 @@ + + + + + + + + <%= t('.report_title') %> + + <%= stylesheet_link_tag 'libs', media: 'all' %> + <%= stylesheet_link_tag 'application', media: 'all' %> + + + +
    +
    + <%= t 'reports.download' %> + <%= link_to 'CSV', url_for(params.merge(format: :csv)) %> + <%= link_to 'PDF', url_for(params.merge(format: :pdf)) %> +
    + <%= yield %> +
    + + diff --git a/app/views/layouts/report.html.haml b/app/views/layouts/report.html.haml deleted file mode 100644 index 6789aa3..0000000 --- a/app/views/layouts/report.html.haml +++ /dev/null @@ -1,20 +0,0 @@ -!!! 5 -%html{lang: "en"} - %head - %meta{charset: "utf-8"} - %meta{"http-equiv" => "X-UA-Compatible", content: "IE=Edge,chrome=1"} - %meta{name: "viewport", content: "width=device-width, initial-scale=1.0"} - %title - =t(".report_title") - = stylesheet_link_tag "libs", media: "all" - = stylesheet_link_tag "application", media: "all" - %link{href: "/favicon.ico", rel: "shortcut icon"} - - %body - .container - .row.exports - = t("reports.download") - = link_to 'CSV', url_for(params.merge(format: :csv)) - = link_to 'PDF', url_for(params.merge(format: :pdf)) - - = yield diff --git a/app/views/offers/dashboard.html.erb b/app/views/offers/dashboard.html.erb new file mode 100644 index 0000000..4c297ed --- /dev/null +++ b/app/views/offers/dashboard.html.erb @@ -0,0 +1,59 @@ +

    + <%= Offer.model_name.human(count: :many) %> + <%= render "shared/show_filter_hint" %> +

    + +<% @offers.each do |cat, offs| %> +
    +

    + <%= cat.name.capitalize %> +

    + <%= render 'shared/posts', posts: offs %> +
    + <%= link_to offers_path(cat: cat.id), class: "more btn btn-primary" do %> + <%= t('global.more') %> + <% end %> +<% end %> diff --git a/app/views/offers/dashboard.html.haml b/app/views/offers/dashboard.html.haml deleted file mode 100644 index 4e0519a..0000000 --- a/app/views/offers/dashboard.html.haml +++ /dev/null @@ -1,34 +0,0 @@ -%h1 - = Offer.model_name.human(count: :many) - = render("/shared/show_filter_hint.html.haml") - - -.navbar - %form.navbar-form.navbar-left{action: offers_path, role: "search", method: "get"} - .form-group - %input.form-control{type: "text", placeholder: t("global.search"), name: "q", value: params[:q]} - %button.btn.btn-default{type: "submit"}= t("global.search") - - %ul.nav.navbar-nav - %li.dropdown - %a.dropdown-toggle{href: "#"} - = @category ? @category.name : Category.model_name.human - %span.caret - %ul.dropdown-menu{role: "menu"} - %li= link_to "× #{t("global.all")}", offers_path - - Category.all.sort_by{ |a| a.name.downcase }.each do |c| - - next if c == @category - %li= link_to c.name, offers_path(cat: c.id) - - %ul.nav.navbar-nav.pull-right - %li - %a{href: new_offer_path} - %span.glyphicon.glyphicon-plus - = t "helpers.submit.create", model: Offer.model_name.human - -- @offers.each do |cat, offs| - .offers - %h3=cat.name.capitalize - = render :partial => 'shared/posts', :locals => { :posts => offs } - - = link_to t('global.more'), offers_path(cat: cat.id), :class=>"more btn btn-primary" diff --git a/app/views/offers/edit.html.erb b/app/views/offers/edit.html.erb new file mode 100644 index 0000000..af46fa4 --- /dev/null +++ b/app/views/offers/edit.html.erb @@ -0,0 +1,5 @@ +

    + <%= @offer.title %> + <%= t ".edit" %> +

    +<%= render 'shared/post_form', post: @offer, label_button: t(".submit") %> diff --git a/app/views/offers/edit.html.haml b/app/views/offers/edit.html.haml deleted file mode 100644 index 53ad1fd..0000000 --- a/app/views/offers/edit.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -%h1 - = @offer.title - %small - = t ".edit" - -= render partial: 'shared/post_form', locals: { post: @offer, label_button: t(".submit") } diff --git a/app/views/offers/index.html.erb b/app/views/offers/index.html.erb new file mode 100644 index 0000000..71e92b7 --- /dev/null +++ b/app/views/offers/index.html.erb @@ -0,0 +1,55 @@ +

    + <% @category = Category.where(id: params[:cat]).first %> + <%= Offer.model_name.human(count: :many) %> + <%= render "shared/show_filter_hint" %> +

    + +
    + <%= render "shared/posts", posts: @offers %> +
    +<%= paginate @offers %> diff --git a/app/views/offers/index.html.haml b/app/views/offers/index.html.haml deleted file mode 100644 index 8bc0312..0000000 --- a/app/views/offers/index.html.haml +++ /dev/null @@ -1,35 +0,0 @@ -%h1 - - @category = Category.where(id: params[:cat]).first - = Offer.model_name.human(count: :many) - = render("/shared/show_filter_hint.html.haml") - -.navbar - %form.navbar-form.navbar-left{action: offers_path, role: "search", - method: "get"} - .form-group - %input.form-control{type: "text", placeholder: t("global.search"), - name: "q", value: params[:q]} - %button.btn.btn-default{type: "submit"}= t("global.search") - - %ul.nav.navbar-nav - %li.dropdown - %a.dropdown-toggle{href: "#"} - = @category ? @category.name : Category.model_name.human - %span.caret - %ul.dropdown-menu{role: "menu"} - %li= link_to "× #{t("global.all")}", dashboard_offers_path - - Category.all.sort_by { |a| a.name.downcase }.each do |c| - - next if c == @category - %li= link_to c.name, offers_path(cat: c.id) - - - if current_user && current_organization && !params[:org] - %ul.nav.navbar-nav.pull-right - %li - %a{href: new_offer_path} - %span.glyphicon.glyphicon-plus - = t "helpers.submit.create", model: Offer.model_name.human - -.offers - = render partial: "shared/posts", locals: { posts: @offers } - -= paginate @offers \ No newline at end of file diff --git a/app/views/offers/index.js.erb b/app/views/offers/index.js.erb new file mode 100644 index 0000000..55d52dc --- /dev/null +++ b/app/views/offers/index.js.erb @@ -0,0 +1,2 @@ +$(".offers").append("<%= j render('shared/posts', posts: @offers) %>"); +$(".offers ~ a[rel=next]").replaceWith("<%= j link_to_next_page(@offers, t('.more'), remote: true, params: params) %>"); diff --git a/app/views/offers/index.js.haml b/app/views/offers/index.js.haml deleted file mode 100644 index 2f27595..0000000 --- a/app/views/offers/index.js.haml +++ /dev/null @@ -1,2 +0,0 @@ -$('.offers').append('#{escape_javascript(render partial: "shared/posts", :locals => { :posts => @offers })}'); -$('.offers ~ a[rel=next]').replaceWith('#{link_to_next_page @offers, t('.more'), remote: true, params: params}'); diff --git a/app/views/offers/new.html.erb b/app/views/offers/new.html.erb new file mode 100644 index 0000000..31462f2 --- /dev/null +++ b/app/views/offers/new.html.erb @@ -0,0 +1,4 @@ +

    + <%= t "helpers.submit.create", model: @offer.class.model_name.human %> +

    +<%= render 'shared/post_form', post: @offer, label_button: t(".submit") %> diff --git a/app/views/offers/new.html.haml b/app/views/offers/new.html.haml deleted file mode 100644 index b60c75a..0000000 --- a/app/views/offers/new.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -%h1= t "helpers.submit.create", model: @offer.class.model_name.human - -= render partial: 'shared/post_form', locals: {post: @offer, label_button: t(".submit") } diff --git a/app/views/offers/show.html.erb b/app/views/offers/show.html.erb new file mode 100644 index 0000000..95d9e3a --- /dev/null +++ b/app/views/offers/show.html.erb @@ -0,0 +1,22 @@ +

    + <% if admin? or @offer.user == current_user %> + <%= link_to edit_offer_path(@offer), class: "btn btn-warning" do %> + <%= glyph :pencil %> + <%= t "global.edit" %> + <% end %> + <%= link_to @offer, + data: { method: :DELETE, confirm: "sure?" }, + class: "btn btn-danger" do %> + <%= glyph :trash %> + <%= t "global.delete" %> + <% end %> + <% end %> + <% if current_user and @offer.user != current_user %> + <%= link_to give_time_user_path(@offer.user, offer: @offer.id), + class: "btn btn-success" do %> + <%= glyph :time %> + <%= t ".give_time_for" %> + <% end %> + <% end %> +

    +<%= render "shared/post", post: @offer %> diff --git a/app/views/offers/show.html.haml b/app/views/offers/show.html.haml deleted file mode 100644 index 0475636..0000000 --- a/app/views/offers/show.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -= render "shared/post", post: @offer - - -%p.actions - - if admin? or @offer.user == current_user - = link_to edit_offer_path(@offer), class: "btn btn-warning" do - = glyph :pencil - = t "global.edit" - - = link_to @offer, data: {method: :DELETE, confirm: "sure?" }, :class => "btn btn-danger" do - = glyph :trash - = t "global.delete" - - if current_user and @offer.user != current_user - = link_to(give_time_user_path(@offer.user, offer: @offer.id), {:class => "btn btn-success"}) do - = glyph(:time) - = t ".give_time_for" diff --git a/app/views/organizations/_form.html.erb b/app/views/organizations/_form.html.erb new file mode 100644 index 0000000..47d4af5 --- /dev/null +++ b/app/views/organizations/_form.html.erb @@ -0,0 +1,12 @@ +<%= simple_form_for @organization do |f| %> + <%= f.input :name %> + <%= f.input :email %> + <%= f.input :phone %> + <%= f.input :web %> + <%= f.input :description %> + <%= f.input :public_opening_times %> + <%= f.input :address %> + <%= f.input :neighborhood %> + <%= f.input :city %> + <%= f.button :submit %> +<% end %> diff --git a/app/views/organizations/_form.html.haml b/app/views/organizations/_form.html.haml deleted file mode 100644 index 0bc1f28..0000000 --- a/app/views/organizations/_form.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -= simple_form_for @organization do |f| - = f.input :name - = f.input :email - = f.input :phone - = f.input :web - = f.input :description - = f.input :public_opening_times - = f.input :address - = f.input :neighborhood - = f.input :city - = f.button :submit diff --git a/app/views/organizations/edit.html.erb b/app/views/organizations/edit.html.erb new file mode 100644 index 0000000..958a418 --- /dev/null +++ b/app/views/organizations/edit.html.erb @@ -0,0 +1,12 @@ +<% if @organization.errors.present? %> + <% @organization.errors.full_messages.each do |msg| %> + + <% end %> +<% end %> +

    + <%= link_to @organization, organization_path(@organization) %> + <%= t 'global.edit' %> +

    +<%= render 'form' %> diff --git a/app/views/organizations/edit.html.haml b/app/views/organizations/edit.html.haml deleted file mode 100644 index adb47d9..0000000 --- a/app/views/organizations/edit.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -- if @organization.errors.size > 0 - - @organization.errors.full_messages.each do |msg| - .alert.alert-danger{:role=> "alert"} - =msg -%h1 - = link_to @organization, organization_path(@organization) - %small= t "global.edit" - -= render partial: "form" diff --git a/app/views/organizations/give_time.html.erb b/app/views/organizations/give_time.html.erb new file mode 100644 index 0000000..02787bd --- /dev/null +++ b/app/views/organizations/give_time.html.erb @@ -0,0 +1,63 @@ +

    + <%= t '.give_time' %> + <%= link_to @organization, organization_path(@organization) %> +

    +<% if @offer %> +

    + <%= @offer %> +

    +<% end %> +<%= simple_form_for @transfer do |f| %> +
    + <%= f.input :hours, + as: :integer, + input_html: { + min: 0, + max: 20, + 'data-rule-either-hours-minutes-informed' => 'true', + 'data-rule-range' => '[0,20]' + } %> + <%= f.input :minutes, + as: :integer, + input_html: { + min: 0, + max: 59, + step: 15, + 'data-rule-either-hours-minutes-informed' => 'true', + 'data-rule-range' => '[0,59]' + } %> + <%= f.input :amount, as: :hidden %> + <%= f.input :reason %> + <%= f.input :destination, as: :hidden %> + <% if admin? %> +
    + <%= f.label :source %> + <%# TODO: refactor. it's very complex for a view. %> + <%= f.select :source, + options_for_select( + @sources.sort_by { |source| [source.accountable_type, source.accountable_id] } + .map { |a| ["#{a.accountable_type == 'Member' ? a.accountable.member_uid : a.accountable_id} #{a.accountable_type} #{a.accountable.to_s}", a.id] }, + selected: current_user.member(current_organization).account.id + ), + {}, + id: 'select2-time', + class: 'form-control' %> +
    + <% end %> + <% if @offer %> + <%= f.input :post, as: :hidden %> + <% end %> +
    +
    + <%= f.button :submit, + class: 'btn btn-default', + style: 'margin-bottom: 20px;' %> +
    +<% end %> + diff --git a/app/views/organizations/give_time.html.haml b/app/views/organizations/give_time.html.haml deleted file mode 100644 index 5a63b71..0000000 --- a/app/views/organizations/give_time.html.haml +++ /dev/null @@ -1,30 +0,0 @@ -%h1 - %small= t ".give_time" - = link_to @organization, organization_path(@organization) - -- if @offer - %h3= @offer - -= simple_form_for @transfer do |f| - .form-inputs - = f.input :hours, as: :integer, input_html: { min: 0, max: 20, "data-rule-either-hours-minutes-informed" => "true", "data-rule-range" => "[0,20]"} - = f.input :minutes, as: :integer, input_html: { min: 0, max: 59, step: 15, "data-rule-either-hours-minutes-informed" => "true", "data-rule-range" => "[0,59]"} - = f.input :amount, as: :hidden - = f.input :reason - = f.input :destination, as: :hidden - - if admin? - .form-group - = f.label :source - = f.select :source, options_for_select(@sources.sort_by{ |source| [source.accountable_type, source.accountable_id]}.map{ |a| ["#{a.accountable_type == "Member" ? a.accountable.member_uid : a.accountable_id} #{a.accountable_type} #{a.accountable.to_s}", a.id]}, selected: current_user.member(current_organization).account.id), {}, { id: "select2-time", class: "form-control" } - - if @offer - = f.input :post, as: :hidden - - .form-actions - = f.button :submit, class: "btn btn-default", style: "margin-bottom: 20px;" - -:javascript - $("#select2-time").select2({ - formatNoMatches: function() { - return "#{t 'application.tips.user_not_found'}"; - } - }) diff --git a/app/views/organizations/index.html.erb b/app/views/organizations/index.html.erb new file mode 100644 index 0000000..896027a --- /dev/null +++ b/app/views/organizations/index.html.erb @@ -0,0 +1,46 @@ +

    + <%= Organization.model_name.human(count: :many) %> +

    + + + + + + + + + + + + + <% @organizations.each do |org| %> + + + + + + <% end %> + +
    <%= Organization.model_name.human(count: :one) %><%= t '.member_count' %><%= glyph :wrench %><%= t 'global.table.actions' %>
    <%= link_to org.name, org %><%= org.users.count %> + <% if current_user.admins?(org) %> + <%= link_to edit_organization_path(org), class: 'action' do %> + <%= glyph :pencil %> + <%= t 'global.edit' %> + <% end %> + <%= link_to organization_path(org), + data: { method: :delete }, + class: 'action' do %> + <%= glyph :trash %> + <%= t 'global.borrar' %> + <% end %> + <% end %> +
    diff --git a/app/views/organizations/index.html.haml b/app/views/organizations/index.html.haml deleted file mode 100644 index b8eb2df..0000000 --- a/app/views/organizations/index.html.haml +++ /dev/null @@ -1,34 +0,0 @@ -%h1 - = Organization.model_name.human(count: :many) - -%ul.nav.nav-pills - - if superadmin? - %li - %a{href: new_organization_path} - %span.glyphicon.glyphicon-plus - = t 'global.add_new' - -%table.table.table-hover.table-condensed - %thead - %tr - %th= Organization.model_name.human(count: :one) - %th= t ".member_count" - %th - %span.glyphicon.glyphicon-wrench - = t "global.table.actions" - %tbody - - @organizations.each do |org| - %tr - %td - = link_to(org.name, org) - %td - = org.users.count - %td.hover-actions - - if current_user.admins?(org) - %a.action{href: edit_organization_path(org)} - %span.glyphicon.glyphicon-pencil - = t "global.edit" - %a.action{href: organization_path(org), data: {method: :delete}} - %span.glyphicon.glyphicon-trash - = t "global.borrar" - diff --git a/app/views/organizations/new.html.erb b/app/views/organizations/new.html.erb new file mode 100644 index 0000000..bb6907b --- /dev/null +++ b/app/views/organizations/new.html.erb @@ -0,0 +1,4 @@ +

    + <%= t '.new' %> +

    +<%= render 'form' %> diff --git a/app/views/organizations/new.html.haml b/app/views/organizations/new.html.haml deleted file mode 100644 index 31feb49..0000000 --- a/app/views/organizations/new.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -%h1 - = t ".new" -= render partial: "form" diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb new file mode 100644 index 0000000..85b0e64 --- /dev/null +++ b/app/views/organizations/show.html.erb @@ -0,0 +1,124 @@ +

    + <%= link_to @organization, organization_path(@organization) %> +

    +
    +
    +
    +
    +

    + <%= t '.contact_information' %> +

    +
    +
    +

    + + <%= Organization.human_attribute_name 'email' %> + + <%= @organization.email %> +
    + + <%= Organization.human_attribute_name 'phone' %> + + <%= @organization.phone %> +
    + Web + <%= link_to_if @organization.web.present?, + @organization.web, + @organization.web %> +
    + + <%= Organization.human_attribute_name 'public_opening_times' %> + +
    + <%= @organization.public_opening_times %> +
    + + <%= Organization.human_attribute_name 'address' %> + + <%= @organization.address %> +
    + + <%= Organization.human_attribute_name 'neighborhood' %> + + <%= @organization.neighborhood %> +
    + + <%= Organization.human_attribute_name 'city' %> + + <%= @organization.city %> +

    +
    +
    +
    +
    +
    +
    +

    + <%= t 'global.information' %> +

    +
    +
    +

    + + <%= Organization.human_attribute_name 'created_at' %> + + <%= l @organization.created_at, format: :long %> +
    + + <%= Organization.human_attribute_name 'updated_at' %> + + <%= l @organization.updated_at, format: :long %> +
    + + <%= t 'global.member_count' %> + + <%= @organization.members.count %> +
    + + <%= t 'global.balance' %> + + <%= seconds_to_hm(@organization.account.try(:balance) || '—') %> +

    +
    +
    +
    +
    + +
    +
    + +<% if current_user %> + <%= render "shared/movements" %> +<% end %> diff --git a/app/views/organizations/show.html.haml b/app/views/organizations/show.html.haml deleted file mode 100644 index 70d4b71..0000000 --- a/app/views/organizations/show.html.haml +++ /dev/null @@ -1,71 +0,0 @@ -%h1 - = link_to @organization, organization_path(@organization) -.row - .col-sm-4 - .panel.panel-default - .panel-heading - %h3.panel-title= t ".contact_information" - .panel-body - %p - %strong= Organization.human_attribute_name("email") - = @organization.email - %br - %strong= Organization.human_attribute_name("phone") - = @organization.phone - %br - %strong Web - =link_to_if(@organization.web.present?,@organization.web,@organization.web) - %br - %strong= Organization.human_attribute_name("public_opening_times") - %br - = @organization.public_opening_times - %br - %strong= Organization.human_attribute_name("address") - = @organization.address - %br - %strong= Organization.human_attribute_name("neighborhood") - = @organization.neighborhood - %br - %strong= Organization.human_attribute_name("city") - = @organization.city - - .col-sm-3 - .panel.panel-default - .panel-heading - %h3.panel-title= t "global.information" - .panel-body - %p - %strong= Organization.human_attribute_name("created_at") - = l(@organization.created_at, format: :long) - %br - %strong= Organization.human_attribute_name("updated_at") - = l(@organization.updated_at, format: :long) - %br - %strong= t "global.member_count" - = @organization.members.count - %br - %strong= t "global.balance" - = seconds_to_hm(@organization.account.try(:balance) || mdash) - .col-sm-5 - %ul.nav.nav-pills.pull-right - - if superadmin? - %li - %a{href: organizations_path} - %span.glyphicon.glyphicon-hand-left - = t 'global.back' - - if admin? - %li - %a{href: edit_organization_path(@organization)} - %span.glyphicon.glyphicon-pencil - = t "global.edit" - - if superadmin? - %li - %a{href: organization_path(@organization), data: {method: :DELETE, confirm: t("are_you_sure") }} - %span.glyphicon.glyphicon-trash - = t "global.delete" - %li - %a{href: give_time_organization_path(@organization)} - %span.glyphicon.glyphicon-time - = t "global.give_time" -- if current_user - = render "shared/movements" diff --git a/app/views/pages/about.ca.html.erb b/app/views/pages/about.ca.html.erb new file mode 100644 index 0000000..72c2896 --- /dev/null +++ b/app/views/pages/about.ca.html.erb @@ -0,0 +1,97 @@ +<%= content_for :window_title do %> + TimeOverflow - Gestió on-line de Bancs de Temps +<% end %> + +
    + <% if current_user and !current_organization %> + <%= render 'organization_list' %> + <% end %> +
    +
    +
    +

    TimeOverflow

    + <%= image_tag "sand-clock.png", width: 50 %> +

    El software disenyat per i per als Bancs de Temps

    + TimeOverflow és lliure, gratuït i col·laboratiu +
    + +
    +

    Funcionalitats de TimeOverflow:

    +
      +
    • + Gestió del Banc de Temps amb perfils d'administració +
        +
      • Altes/baixes/modificacions de membres
      • +
      • Publicar ofertes i demandes
      • +
      • Introduir xecs i gestionar la comptabilitat
      • +
      +
    • +
    • + Xarxa social i banca en línia accessible pels membres +
        +
      • Els membres d'un Banc de Temps poden accedir al sistema i + contactar amb altres membres
      • +
      • Publicar ofertes i demandes
      • +
      • Pagar hores a altres membres
      • +
      +
    • +
    +
    + +

    Ets un Banc de Temps?

    + +
    +

    + (ens posarem en contacte amb tu per posar-lo en marxa o fer-vos + una demostració) +

    +
    +
    + +
    +
    +

    Ja ets membre d'un Banc de Temps que fa servir TimeOverflow?

    + + Entra aquí + +
    +

    +

    Si ets una persona interessada a participar en un Banc de Temps, + busca el teu Banc de Temps més proper a + bdtonline.org. +

    +

    + + <%= image_tag "oferta.png", class: "img-responsive center-block" %> + +

    Internet potencia els Bancs de Temps

    +

    TimeOveflow està especialment dissenyat per i per als Bancs de Temps + que existeixen físicament(veure mapa), + la seva fi és potenciar gràcies a Internet. +

    +

    Gràcies al treball conjunt de CoopDevs + i la ADBdT + avui podem oferir el sofware TimeOverflow a tots els Bancs de + Temps que així ho desitgin de manera lliure i gratuïta. +

    + +

    El codi font de TimeOverflow està disponible sota una llicència + open source, ja es pot descarregar a + https://github.com/coopdevs/timeoverflow +

    +
    + <%= link_to image_tag("github.png", alt: "Github logo", height: 30), + "https://github.com/coopdevs/timeoverflow", + title: "TimeOverflow Github" %> +
    +
    +
    +
    diff --git a/app/views/pages/about.ca.html.haml b/app/views/pages/about.ca.html.haml deleted file mode 100644 index 926c6b6..0000000 --- a/app/views/pages/about.ca.html.haml +++ /dev/null @@ -1,66 +0,0 @@ -= content_for :window_title do - TimeOverflow - Gestió on-line de Bancs de Temps - -.container-inner - - if current_user and !current_organization - = render 'organization_list' - .row - .col-sm-6 - .text-center - %h1 TimeOverflow - = image_tag "sand-clock.png", width: 50 - %h2 El software disenyat per i per als Bancs de Temps - %em TimeOverflow és lliure, gratuït i col·laboratiu - - .text-left{style: "margin-top: 40px;"} - :markdown - Funcionalitats de **TimeOverflow**: - - * Gestió del Banc de Temps amb perfils d'administració - * Altes/baixes/modificacions de membres - * Publicar ofertes i demandes - * Introduir xecs i gestionar la comptabilitat - * Xarxa social i banca en línia accessible pels membres - * Els membres d'un Banc de Temps poden accedir al sistema i contactar amb altres membres - * Publicar ofertes i demandes - * Pagar hores a altres membres - - %h2 Ets un Banc de Temps? - .text-center - %a.btn.btn-primary.btn-large{href: "http://adbdt.org/ca/contacta/", style:"font-size:30px;margin-top:20px;"} - Sol·licita accés a TimeOverflow - .text-center - %p - %em (ens posarem en contacte amb tu per posar-lo en marxa o fer-vos una demostració) - - .col-sm-6 - .text-center - %h2 Ja ets membre d'un Banc de Temps que fa servir TimeOverflow? - %a.btn.btn-primary.btn-large{href: new_user_session_path, style:"font-size:30px;margin-top:20px;"} - Entra aquí - - %p - :markdown - Si ets una persona interessada a participar en un Banc de Temps, - busca el teu Banc de Temps més proper a - [bdtonline.org](http://www.bdtonline.org "Bancs de Temps"). - - = image_tag "oferta.png", class: "img-responsive center-block" - - %h2 Internet potencia els Bancs de Temps - :markdown - TimeOveflow està especialment dissenyat ** per i per als Bancs de Temps ** - que existeixen físicament([veure mapa](http://www.bdtonline.org "Bancs de Temps")), - la seva fi és potenciar gràcies a Internet. - - Gràcies al treball conjunt de [CoopDevs](https://github.com/coopdevs) - i la [ADBdT](http://adbdt.org/ca "Associació per al Desenvolupament dels Bancs de Temps") - avui podem oferir el sofware **TimeOverflow** a tots els Bancs de - Temps que així ho desitgin de manera lliure i gratuïta. - - El codi font de TimeOverflow està disponible sota una llicència - open source, ja es pot descarregar a [https://github.com/coopdevs/timeoverflow](https://github.com/coopdevs/timeoverflow) - - .text-center - = link_to "https://github.com/coopdevs/timeoverflow", title: "TimeOverflow Github" do - = image_tag("github.png", alt: "Github logo", height: 30) diff --git a/app/views/pages/about.en.html.erb b/app/views/pages/about.en.html.erb new file mode 100644 index 0000000..d9eb891 --- /dev/null +++ b/app/views/pages/about.en.html.erb @@ -0,0 +1,100 @@ +<%= content_for :window_title do %> +TimeOverflow - Time Bank on-line management +<% end %> + +
    +
    +
    +
    +

    TimeOverflow

    + <%= image_tag "sand-clock.png", width: 50 %> +

    The software designed by and for Time Banks

    + TimeOverflow is open source, free and collaborative +
    +
    +

    Features of + TimeOverflow:

    + +
      +
    • + Time Bank management with administration roles +
        +
      • Creation/deletion/updates of bank members
      • +
      • Posting of offers and inquiries
      • +
      • Enter checks and manage accounting
      • +
      +
    • +
    • + Social network and online banking accessible by members +
        +
      • Members of a Time Bank can access the system and connect with other members
      • +
      • Posting of offers and inquiries
      • +
      • Pay hours to other members
      • +
      +
    • +
    +
    + +

    Are you a Time Bank?

    + +
    +

    + (We will contact you to start it up or make you a demonstration) +

    +
    +
    + +
    +
    +

    Already a member of a Time Bank that uses TimeOverflow?

    + + Click here + +
    +

    +

    If you are a person interested in participating in a Time Bank, find your + closest Time Bank at + bdtonline.org. +

    +

    + <%= image_tag "oferta.png", class: "img-responsive center-block" %> + +

    Internet enhances Time Banks activity

    +

    TimeOveflow is specially designed + for and by Time Banks + that physically exist (see map), and its purpose is to boost them thanks to Internet. +

    + +

    Thanks to the joint job of + CoopDevs + and + ADBdT + today we can offer the software + TimeOverflow + to all Time Banks that want it, open and for free. +

    + +

    The source code of TimeOverflow is available based on an open source license + and you can download it at + https://github.com/coopdevs/timeoverflow +

    +
    + <%= link_to image_tag("github.png", alt: "Github logo", height: 30), + "https://github.com/coopdevs/timeoverflow", + title: "TimeOverflow Github" %> +
    +
    +
    +
    diff --git a/app/views/pages/about.en.html.haml b/app/views/pages/about.en.html.haml deleted file mode 100644 index fab9fe2..0000000 --- a/app/views/pages/about.en.html.haml +++ /dev/null @@ -1,66 +0,0 @@ -= content_for :window_title do - TimeOverflow - Time Bank on-line management - -.container-inner - - if current_user and !current_organization - = render 'organization_list' - .row - .col-sm-6 - .text-center - %h1 TimeOverflow - = image_tag "sand-clock.png", width: 50 - %h2 The software designed by and for Time Banks - %em TimeOverflow is open source, free and collaborative - - .text-left{style: "margin-top: 40px;"} - :markdown - Features of **TimeOverflow**: - - * Time Bank management with administration roles - * Creation/deletion/updates of bank members - * Posting of offers and inquiries - * Enter checks and manage accounting - * Social network and online banking accessible by members - * Members of a Time Bank can access the system and connect with other members - * Posting of offers and inquiries - * Pay hours to other members - - %h2 Are you a Time Bank? - .text-center - %a.btn.btn-primary.btn-large{href: "http://adbdt.org/contacta/", style:"font-size:30px;margin-top:20px;"} - Request access to TimeOverflow - .text-center - %p - %em (We will contact you to start it up or make you a demonstration) - - .col-sm-6 - .text-center - %h2 Already a member of a Time Bank that uses TimeOverflow? - %a.btn.btn-primary.btn-large{href: new_user_session_path, style:"font-size:30px;margin-top:20px;"} - Click here - - %p - :markdown - If you are a person interested in participating in a Time Bank, - find your closest Time Bank at - [bdtonline.org](http://www.bdtonline.org "Bancos de Tiempo"). - - = image_tag "oferta.png", class: "img-responsive center-block" - - %h2 Internet enhances Time Banks activity - :markdown - TimeOveflow is specially designed **for and by Time Banks** - that physically exist ([see map](http://www.bdtonline.org "Bancos de Tiempo")), - and its purpose is to boost them thanks to Internet. - - Thanks to the joint job of [CoopDevs](https://github.com/coopdevs) - and [ADBdT](http://adbdt.org "Association for the Development of Time Banks") - today que can offer the software **TimeOverflow** to all Time Banks - that want it, open and for free. - - The source code of TimeOverflow is available based on an open source - license and you can download it at [https://github.com/coopdevs/timeoverflow](https://github.com/coopdevs/timeoverflow) - - .text-center - = link_to "https://github.com/coopdevs/timeoverflow", title: "TimeOverflow Github" do - = image_tag("github.png", alt: "Github logo", height: 30) diff --git a/app/views/pages/about.html.erb b/app/views/pages/about.html.erb new file mode 100644 index 0000000..f719d19 --- /dev/null +++ b/app/views/pages/about.html.erb @@ -0,0 +1,91 @@ +
    +
    +
    +
    +

    TimeOverflow

    + <%= image_tag "sand-clock.png", width: 50 %> +

    El software diseñado por y para los Bancos de Tiempo

    + TimeOverflow es libre, gratuito y colaborativo +
    +
    +

    Funcionalidades de + TimeOverflow:

    + +
      +
    • + Gestión del Banco de Tiempo con perfiles de administración +
        +
      • Altas/bajas/modificaciones de miembros
      • +
      • Publicar ofertas y demandas
      • +
      • Introducir cheques y gestionar la contabilidad
      • +
      +
    • +
    • + Red social y banca on-line accesible por los miembros +
        +
      • Los miembros de un Banco de Tiempo pueden acceder al sistema + y contactar con otros miembros
      • +
      • Publicar ofertas y demandas
      • +
      • Pagar horas a otros miembros
      • +
      +
    • +
    +
    +

    ¿Eres un Banco de Tiempo?

    + +
    +

    + (nos pondremos en contacto contigo para ponerlo en marcha o haceros una + demostración) +

    +
    +
    +
    +
    +

    ¿Ya eres miembro de un Banco de Tiempo que usa TimeOverflow?

    + + Entra aquí + +
    +

    +

    Si eres una persona interesada en participar en un Banco de Tiempo, busca tu + Banco de Tiempo más cercano en + bdtonline.org.

    +

    + <%= image_tag "oferta.png", class: "img-responsive center-block" %> + +

    Internet potencia los Bancos de Tiempo

    +

    TimeOveflow está especialmente diseñado + por y para los Bancos de Tiempo + que existen físicamente (ver mapa), su fin es potenciarlos gracias a Internet.

    + +

    Gracias al trabajo conjunto de + CoopDevs + y la + ADBdT + hoy podemos ofrecer el sofware + TimeOverflow + a todos los Bancos de Tiempo que así lo deseen de manera libre y gratuita.

    + +

    El código fuente de TimeOverflow está disponible bajo una licencia open + source, ya se puede descargar en + https://github.com/coopdevs/timeoverflow +

    +
    + <%= link_to image_tag("github.png", alt: "Github logo", height: 30), + "https://github.com/coopdevs/timeoverflow", + title: "TimeOverflow Github" %> +
    +
    +
    +
    diff --git a/app/views/pages/about.html.haml b/app/views/pages/about.html.haml deleted file mode 100644 index d17c567..0000000 --- a/app/views/pages/about.html.haml +++ /dev/null @@ -1,66 +0,0 @@ -= content_for :window_title do - TimeOverflow - Gestión on-line de Bancos de Tiempo - -.container-inner - - if current_user and !current_organization - = render 'organization_list' - .row - .col-sm-6 - .text-center - %h1 TimeOverflow - = image_tag "sand-clock.png", width: 50 - %h2 El software diseñado por y para los Bancos de Tiempo - %em TimeOverflow es libre, gratuito y colaborativo - - .text-left{style: "margin-top: 40px;"} - :markdown - Funcionalidades de **TimeOverflow**: - - * Gestión del Banco de Tiempo con perfiles de administración - * Altas/bajas/modificaciones de miembros - * Publicar ofertas y demandas - * Introducir cheques y gestionar la contabilidad - * Red social y banca on-line accesible por los miembros - * Los miembros de un Banco de Tiempo pueden acceder al sistema y contactar con otros miembros - * Publicar ofertas y demandas - * Pagar horas a otros miembros - - %h2 ¿Eres un Banco de Tiempo? - .text-center - %a.btn.btn-primary.btn-large{href: "http://adbdt.org/contacta/", style:"font-size:30px;margin-top:20px;"} - Solicita acceso a TimeOverflow - .text-center - %p - %em (nos pondremos en contacto contigo para ponerlo en marcha o haceros una demostración) - - .col-sm-6 - .text-center - %h2 ¿Ya eres miembro de un Banco de Tiempo que usa TimeOverflow? - %a.btn.btn-primary.btn-large{href: new_user_session_path, style:"font-size:30px;margin-top:20px;"} - Entra aquí - - %p - :markdown - Si eres una persona interesada en participar en un Banco de Tiempo, - busca tu Banco de Tiempo más cercano en - [bdtonline.org](http://www.bdtonline.org "Bancos de Tiempo"). - - = image_tag "oferta.png", class: "img-responsive center-block" - - %h2 Internet potencia los Bancos de Tiempo - :markdown - TimeOveflow está especialmente diseñado **por y para los Bancos de Tiempo** - que existen físicamente ([ver mapa](http://www.bdtonline.org "Bancos de Tiempo")), - su fin es potenciarlos gracias a Internet. - - Gracias al trabajo conjunto de [CoopDevs](https://github.com/coopdevs) - y la [ADBdT](http://adbdt.org "Asociación para el Desarrollo de los Bancos de Tiempo") - hoy podemos ofrecer el sofware **TimeOverflow** a todos los Bancos de - Tiempo que así lo deseen de manera libre y gratuita. - - El código fuente de TimeOverflow está disponible bajo una licencia - open source, ya se puede descargar en [https://github.com/coopdevs/timeoverflow](https://github.com/coopdevs/timeoverflow) - - .text-center - = link_to "https://github.com/coopdevs/timeoverflow", title: "TimeOverflow Github" do - = image_tag("github.png", alt: "Github logo", height: 30) diff --git a/app/views/reports/post_list.html.erb b/app/views/reports/post_list.html.erb new file mode 100644 index 0000000..786bac8 --- /dev/null +++ b/app/views/reports/post_list.html.erb @@ -0,0 +1,27 @@ +
    + + + + + + + + + + + + + <% @posts.each do |cat, ps| %> + + + + <% ps.each do |post| %> + + + + + <% end %> + <% end %> + +
    <%= @post_type.model_name.human %><%= User.model_name.human %>

    <%= cat || '—' %>

    <%= post.title %><%= "#{post.user} (#{post.member_uid})" %>
    +
    diff --git a/app/views/reports/post_list.html.haml b/app/views/reports/post_list.html.haml deleted file mode 100644 index 06e5724..0000000 --- a/app/views/reports/post_list.html.haml +++ /dev/null @@ -1,19 +0,0 @@ -.row - %table.table.table-condensed.table-bordered - %colgroup - %col.col-sm-9 - %col.col-sm-3 - %thead - %tr - %th= @post_type.model_name.human - %th= User.model_name.human - %tbody - - @posts.each do |cat, ps| - %tr.success - %td{colspan: 2} - %h4= cat || raw("—") - - ps.each do |post| - %tr - %td - %strong= post.title - %td= "#{post.user} (#{post.member_uid})" diff --git a/app/views/reports/user_list.html.erb b/app/views/reports/user_list.html.erb new file mode 100644 index 0000000..9dca6fb --- /dev/null +++ b/app/views/reports/user_list.html.erb @@ -0,0 +1,27 @@ +
    + + + + + + + + + + + + + <% @members.each do |u| %> + + + + + + + + <% end %> + + +
    N<%= User.human_attribute_name :username %><%= User.human_attribute_name :email %><%= User.human_attribute_name :phone %><%= User.human_attribute_name :alt_phone %>
    <%= u.member_uid %><%= u.user.username %><%= u.user.email_if_real %><%= u.user.phone %><%= u.user.alt_phone %>
    +
    diff --git a/app/views/reports/user_list.html.haml b/app/views/reports/user_list.html.haml deleted file mode 100644 index 4ebbacb..0000000 --- a/app/views/reports/user_list.html.haml +++ /dev/null @@ -1,19 +0,0 @@ -.row - %table.table.table-condensed.table-bordered.table-striped - %thead - %tr - / %th= User.human_attribute_name(:registration_number) - %th N - %th= User.human_attribute_name(:username) - %th= User.human_attribute_name(:email) - %th= User.human_attribute_name(:phone) - %th= User.human_attribute_name(:alt_phone) - %tbody - - @members.each do |u| - %tr - %th= u.member_uid - %td= u.user.username - %td= u.user.email_if_real - %td= u.user.phone - %td= u.user.alt_phone - %tfoot diff --git a/app/views/shared/_movements.html.erb b/app/views/shared/_movements.html.erb new file mode 100644 index 0000000..e5a786d --- /dev/null +++ b/app/views/shared/_movements.html.erb @@ -0,0 +1,68 @@ +
    +
    +

    + <%= t(".movements") %> +

    +
    + + + + + + + + + + + <% @movements.each do |mv| %> + + + + + + + + <% end %> +
    <%= t "global.date" %><%= t "global.source_destination" %><%= t "global.announcements" %><%= t "global.reason" %><%= t "global.amount" %>
    + <%= l mv.created_at.to_date, format: :long %> + + <% mv.other_side.account.tap do |account| %> + <% if account.accountable.present? %> + <% if account.accountable_type == "Organization" %> + <%= link_to account, + organization_path(account.accountable) %> + <% elsif account.accountable.active %> + <%= link_to account.accountable.display_name_with_uid, + user_path(account.accountable.user) %> + <% else %> + <%= t(".inactive_user") %> + <% end %> + <% else %> + <%= t(".deleted_user") %> + <% end %> + <% end %> + + <% if mv.transfer&.post&.active? %> + <%= link_to mv.transfer.post, offer_path(mv.transfer.post) %> + <% else %> + <%= mv.transfer.post %> + <% end %> + + <%= mv.transfer.reason %> + <% if mv.transfer.reason.present? && admin? %> + <%= link_to glyph(:trash), + delete_reason_transfer_path(mv.transfer), + method: :put, + data: { confirm: t(".delete_reason") } %> + <% end %> + + + <%= seconds_to_hm(mv.amount) %> + +
    +
    + <%= paginate @movements %> +
    +
    +
    +
    diff --git a/app/views/shared/_movements.html.haml b/app/views/shared/_movements.html.haml deleted file mode 100644 index aa60ef9..0000000 --- a/app/views/shared/_movements.html.haml +++ /dev/null @@ -1,45 +0,0 @@ -.panel.user-profile - .panel-body - %h3 - = t(".movements") - .transactions - %table.table.table-condensed - %thead - %tr - %th= t "global.date" - %th= t "global.source_destination" - %th= t "global.announcements" - %th= t "global.reason" - %th= t "global.amount" - - @movements.each do |mv| - %tr - %td= l mv.created_at.to_date, format: :long - %td - - mv.other_side.account.tap do |account| - - if account.accountable.present? - - if account.accountable_type == "Organization" - = link_to account, - organization_path(account.accountable) - - elsif account.accountable.active - = link_to account.accountable.display_name_with_uid, - user_path(account.accountable.user) - - else - = t(".inactive_user") - - else - = t(".deleted_user") - %td - - if mv.transfer.try(:post).try(:active?) - = link_to(mv.transfer.post, offer_path(mv.transfer.post)) - - else - = mv.transfer.post - %td - = mv.transfer.reason - - if mv.transfer.reason.present? && admin? - - op = { method: :put, data: { confirm: t(".delete_reason") } } - = link_to(delete_reason_transfer_path(mv.transfer), op) do - %span.glyphicon.glyphicon-trash - %td - %strong{ class: green_red(mv.amount) } - = seconds_to_hm(mv.amount) - .paginate-align - = paginate @movements diff --git a/app/views/shared/_post.html.erb b/app/views/shared/_post.html.erb new file mode 100644 index 0000000..50b76df --- /dev/null +++ b/app/views/shared/_post.html.erb @@ -0,0 +1,72 @@ +

    + <%= post.title %> +

    +
    + +
    +
    +
    + <%= m post.rendered_description.to_html.html_safe %> +
    +
    +
    +
    +<% unless current_user %> +
    + <%= t "posts.show.info", + type: post.class.model_name.human, + organization: post.organization.name %> + <%= link_to t("layouts.application.login"), + new_user_session_path, + class: "btn btn-primary" %> +
    +<% end %> diff --git a/app/views/shared/_post.html.haml b/app/views/shared/_post.html.haml deleted file mode 100644 index bb1b882..0000000 --- a/app/views/shared/_post.html.haml +++ /dev/null @@ -1,53 +0,0 @@ -%h1 - = post.title -.row - .sidebar.col-md-3 - - .panel.panel-info - .panel-heading - %h3.panel-title - = post.class.model_name.human - .panel-body - = l post.created_at.to_date, format: :long - %p - - path = get_index_path(post,cat: post.category) - =link_to path do - %span.glyphicon.glyphicon-folder-open - = post.category - %p - - if post.tags.present? - - post.tags.each do |tag| - %span.badge.alert-success - = glyph(:tag) - - path = get_index_path(post,tag: tag) - =link_to path do - = tag - - -if current_user and current_organization - .panel.panel-info - .panel-heading - %h3.panel-title - = link_to post.member.display_name_with_uid, post.user - .panel-body - = link_to image_tag(avatar_url(post.user, 100)), post.user - %h3 - = t "global.contact_details" - - if post.user.email_if_real != "" - %dt= User.human_attribute_name(:email) - %dd= post.user.email_if_real - - phones = [post.user.phone, post.user.alt_phone].map(&:presence).compact - - if phones.present? - %dt= User.human_attribute_name(:phone) - %dd - - phones.each_with_index do |ph, idx| - - unless idx.zero? - — - = ph - - .col-md-9.lead - = post.rendered_description.to_html.html_safe - -- unless current_user - .alert.alert-info - = t("posts.show.info", type: post.class.model_name.human, organization: post.organization.name) - = link_to t("layouts.application.login"), new_user_session_path, class: "btn btn-primary" diff --git a/app/views/shared/_post_form.html.erb b/app/views/shared/_post_form.html.erb new file mode 100644 index 0000000..7717e54 --- /dev/null +++ b/app/views/shared/_post_form.html.erb @@ -0,0 +1,64 @@ +<%= show_error_messages! post %> +<%= form_for post, html: { name: "form", novalidate: true } do |f| %> +
    + <%= f.label :title, required: true %> + <%= f.text_field :title, class: "form-control" %> +
    +
    + <%= f.label :description %> + <%= f.text_area :description, rows: "10", class: "form-control" %> +

    + <%= t ".you_can_use" %> + Markdown +

    + +
    +
    + <%= f.label :category, required: true %> + <%# TODO: too complex %> + <%= f.select :category_id, + Category.all + .sort_by { |a| a.name.downcase } + .map { |cat| [cat.name, cat.id] }, + { include_blank: true }, + class: "form-control" %> +
    +
    + <%= f.label :tag_list %> + <%= f.select :tag_list, + f.object.tags || [], + { selected: f.object.tags }, + multiple: true, + data: { placeholder: t('application.tips.entertag') }, + id: "tags-js", + class: "form-control" %> +
    + <% if current_user.manages?(current_organization) %> +
    + <%= f.label :user, class: "control-label" %> + <%# TODO: too complex %> + <%= f.select :user_id, + options_for_select(current_organization.members.active + .order("members.member_uid") + .map { |mem| ["#{mem.member_uid} #{mem.user.to_s}", mem.user_id] }, + selected: post.user.id || current_user.id), + {}, + id: "select2", + class: "form-control", + required: true %> +
    + <%= f.hidden_field :publisher_id, value: current_user.id %> + <% end %> +

    + <%= t "global.required_field" %> +

    + <%= f.button label_button, class: "btn btn-default", style: "margin-bottom: 20px;" %> +<% end %> + diff --git a/app/views/shared/_post_form.html.haml b/app/views/shared/_post_form.html.haml deleted file mode 100644 index 16e4bd7..0000000 --- a/app/views/shared/_post_form.html.haml +++ /dev/null @@ -1,37 +0,0 @@ -= show_error_messages!(post) -= form_for(post, html: { name: "form", novalidate: true }) do |f| - .form-group - = f.label :title, required: true - = f.text_field :title, class: "form-control" - .form-group - = f.label :description - = f.text_area :description, rows: "10", class: "form-control" - %p.small.text-right - = t ".you_can_use" - - wiki_url = "https://#{I18n.locale}.wikipedia.org/wiki/Markdown" - %a{ href: wiki_url, title: "Markdown" } Markdown - .form-group - = f.label :category, required: true - = f.select :category_id, Category.all.sort_by{ |a| a.name.downcase }.map{ |cat| [cat.name, cat.id] }, { include_blank: true }, { class: "form-control" } - .form-group - = f.label :tag_list - = f.select :tag_list, f.object.tags || [], { selected: f.object.tags }, multiple: true, data: { placeholder: t('application.tips.entertag') }, id: "tags-js", class: "form-control" - - - if current_user.manages? current_organization - .form-group - = f.label :user, class: "control-label" - = f.select :user_id, options_for_select(current_organization.members.active.order("members.member_uid").map{ |mem| ["#{mem.member_uid} #{mem.user.to_s}", mem.user_id] }, selected: post.user.id || current_user.id), {}, { id: "select2", class: "form-control", required: true } - = f.hidden_field :publisher_id, value: current_user.id - - %p.help-block - = t "global.required_field" - - = f.button label_button, class: "btn btn-default", style: "margin-bottom: 20px;" - -:javascript - - $("#select2").select2({ - formatNoMatches: function() { - return "#{t 'application.tips.user_not_found'}"; - } - }) diff --git a/app/views/shared/_posts.html.erb b/app/views/shared/_posts.html.erb new file mode 100644 index 0000000..c4cfd39 --- /dev/null +++ b/app/views/shared/_posts.html.erb @@ -0,0 +1,27 @@ +<% posts.each do |post| %> +
    +

    + <%= link_to post.title, post %> +

    +

    + <%= strip_tags(post.rendered_description.to_html) %> +

    +

    + + <% if post.category %> + <%= glyph :folder_open %> + + <%= link_to post.category, get_index_path(post, cat: post.category) %> + + <% end %> + <% (post.tags || []).each do |tag| %> + <%= glyph :tag %> + <%= link_to tag, get_index_path(post,tag: tag) %> + <% end %> + + <%= l post.created_at.to_date, format: :long %> + + +

    +
    +<% end %> diff --git a/app/views/shared/_posts.html.haml b/app/views/shared/_posts.html.haml deleted file mode 100644 index 42da8e8..0000000 --- a/app/views/shared/_posts.html.haml +++ /dev/null @@ -1,21 +0,0 @@ -- posts.each do |post| - .post - %h4 - = link_to post do - = post.title - %p= strip_tags(post.rendered_description.to_html) - %p - %small - - if post.category - %span.glyphicon.glyphicon-folder-open - %span.category - - path = get_index_path(post,cat: post.category) - =link_to path do - = post.category - - (post.tags || []).each do |tag| - %span.glyphicon.glyphicon-tag - - path = get_index_path(post,tag: tag) - =link_to path do - = tag - %span.pull-right - = l post.created_at.to_date, format: :long diff --git a/app/views/shared/_show_filter_hint.html.erb b/app/views/shared/_show_filter_hint.html.erb new file mode 100644 index 0000000..15ced97 --- /dev/null +++ b/app/views/shared/_show_filter_hint.html.erb @@ -0,0 +1,18 @@ +<% if @category.present? %> + + <%= glyph :category %> + <%= @category.name %> + +<% end %> +<% if params[:q].present? %> + + <%= glyph :search %> + <%= params[:q] %> + +<% end %> +<% if params[:tag].present? %> + + <%= glyph :tag %> + <%= params[:tag] %> + +<% end %> diff --git a/app/views/shared/_show_filter_hint.html.haml b/app/views/shared/_show_filter_hint.html.haml deleted file mode 100644 index b4f45dd..0000000 --- a/app/views/shared/_show_filter_hint.html.haml +++ /dev/null @@ -1,12 +0,0 @@ -- if @category.present? - %small - = glyph(Category) - = @category.name -- if params[:q].present? - %small - = glyph(:search) - = params[:q] -- if params[:tag].present? - %small - = glyph(:tag) - = params[:tag] diff --git a/app/views/statistics/statistics_all_transfers.html.erb b/app/views/statistics/statistics_all_transfers.html.erb new file mode 100644 index 0000000..5cb16c0 --- /dev/null +++ b/app/views/statistics/statistics_all_transfers.html.erb @@ -0,0 +1,65 @@ +

    + <%= t 'global.statistics' %>: <%= t '.transfers' %> +

    +
    +
    + + + + + + + + + + + + <% @transfers.each do |transfer| %> + + + <% transfer.movements.sort_by(&:amount).each do |mv| %> + + <% end %> + + + + + <% end %> +
    <%= t '.date' %><%= t '.from' %><%= t '.to' %><%= t '.post' %><%= t '.reason' %><%= t '.quantity' %>
    + <%= l transfer.created_at, format: :long %> + + <% mv.account.tap do |account| %> + <% if account.accountable.present? %> + <% if account.accountable_type == 'Organization' %> + <%= link_to account, + organization_path(account.accountable) %> + <% elsif account.accountable.active %> + <%= link_to account.accountable.display_name_with_uid, + user_path(account.accountable.user) %> + <% else %> + <%= t '.inactive_user' %> + <% end %> + <% else %> + <%= t '.deleted_user' %> + <% end %> + <% end %> + + <%= link_to_if transfer.try(:post).try(:active?), + transfer.post, + transfer.post %> + + <%= transfer.reason %> + <% if transfer.reason.present? && admin? %> + <%= link_to glyph(:trash), + delete_reason_transfer_path(transfer), + method: :put, + data: { confirm: t('.delete_reason') } %> + <% end %> + + <%= seconds_to_hm(transfer.movements.first.amount.abs) %> +
    +
    + <%= paginate @transfers %> +
    +
    +
    diff --git a/app/views/statistics/statistics_all_transfers.html.haml b/app/views/statistics/statistics_all_transfers.html.haml deleted file mode 100644 index a22aa50..0000000 --- a/app/views/statistics/statistics_all_transfers.html.haml +++ /dev/null @@ -1,40 +0,0 @@ -%h1= t("global.statistics") + ": " + t(".transfers") -.panel.panel-default - .panel-body - %table.table.table-hover.table-condensed - - %thead - %tr - %th=t(".date") - %th=t(".from") - %th=t(".to") - %th=t(".post") - %th=t(".reason") - %th=t(".quantity") - - @transfers.each do |transfer| - %tr - %td= l transfer.created_at, format: :long - - transfer.movements.sort_by(&:amount).each do |mv| - %td - - mv.account.tap do |account| - - if account.accountable.present? - - if account.accountable_type == "Organization" - = link_to account, - organization_path(account.accountable) - - elsif account.accountable.active - = link_to account.accountable.display_name_with_uid, user_path(account.accountable.user) - - else - = t(".inactive_user") - - else - = t(".deleted_user") - %td - = link_to_if(transfer.try(:post).try(:active?), transfer.post, transfer.post) - %td - = transfer.reason - - if transfer.reason.present? && admin? - = link_to delete_reason_transfer_path(transfer), method: :put, data: { confirm: t(".delete_reason") } do - %span.glyphicon.glyphicon-trash - %td= seconds_to_hm(transfer.movements.first.amount.abs) - - .paginate-align - = paginate @transfers diff --git a/app/views/statistics/statistics_demographics.html.haml b/app/views/statistics/statistics_demographics.html.erb similarity index 65% rename from app/views/statistics/statistics_demographics.html.haml rename to app/views/statistics/statistics_demographics.html.erb index ed7c556..eb5d6a1 100644 --- a/app/views/statistics/statistics_demographics.html.haml +++ b/app/views/statistics/statistics_demographics.html.erb @@ -1,13 +1,18 @@ -%h1= t("global.statistics") + ": " + t(".demographics") -.panel.panel-default - .panel-body - #pie +

    + <%= t 'global.statistics' %>: <%= t '.demographics' %> +

    +
    +
    +
    +
    +
    -:javascript - window.onload = function () { + diff --git a/app/views/statistics/statistics_global_activity.html.erb b/app/views/statistics/statistics_global_activity.html.erb new file mode 100644 index 0000000..9d8cf7c --- /dev/null +++ b/app/views/statistics/statistics_global_activity.html.erb @@ -0,0 +1,98 @@ +

    + <%= t 'global.statistics' %>: <%= t '.global_activity' %> +

    +
    +
    +
    + +
    + +
    +
    +
    + + diff --git a/app/views/statistics/statistics_global_activity.html.haml b/app/views/statistics/statistics_global_activity.html.haml deleted file mode 100644 index c6b0a0b..0000000 --- a/app/views/statistics/statistics_global_activity.html.haml +++ /dev/null @@ -1,74 +0,0 @@ -%h1= t("global.statistics") + ": " + t(".global_activity") -%div{ ng_controller: "" } - .panel.panel-default - .panel-body - %ul.nav.nav-pills.statistics - %li - = t ".users_reg" - .badge - = @active_members.count - %li - = t ".num_swaps" - .badge - = @num_swaps - %li - = t ".total_hours" - .badge - = seconds_to_hm @total_hours - %form.navbar-form.navbar-right - .form-group - %input.form-control{id: "datepicker_from", placeholder: t(".ini_date"), name: "ini", value: params[:ini]} - %input.form-control{id: "datepicker_to", placeholder: t(".end_date"), name: "fin", value: params[:fin]} - %button.btn.btn-default{type: :submit}= t(".show") - #chart - -:javascript - window.onload = function () { - //globales - $('#chart').highcharts({ - chart: { - type: 'column' - }, - title: { - text: "#{t '.bank_activity'}" - }, - subtitle: { - text: "#{t '.per_month'}" - }, - xAxis: { - categories: #{@months_names.to_json} - }, - yAxis: { - min: 0, - title: { - text: '' - } - }, - tooltip: { - headerFormat: '{point.key}', - pointFormat: '' + - '', - footerFormat: '
    {series.name}: {point.y}
    ', - shared: true, - useHTML: true - }, - plotOptions: { - column: { - pointPadding: 0.2, - borderWidth: 0 - } - }, - series: [{ - name: "#{t '.users_reg'}", - data: #{@user_reg_months.to_json} - - }, { - name: "#{t ".num_swaps"}", - data: #{@num_swaps_months.to_json} - - }, { - name: "#{t ".total_hours"}", - data: #{@hours_swaps_months.to_json} - }] - }); - } diff --git a/app/views/statistics/statistics_inactive_users.html.erb b/app/views/statistics/statistics_inactive_users.html.erb new file mode 100644 index 0000000..4769bbd --- /dev/null +++ b/app/views/statistics/statistics_inactive_users.html.erb @@ -0,0 +1,30 @@ +

    + <%= t 'global.statistics' %>: <%= t '.inactive_users' %> +

    +
    +
    + + + + + + + + + + + <%# Por días sin movimientos %> + <% @members.includes(:account) + .sort_by(&:days_without_swaps) + .reverse + .each do |mem| %> + + + + + + + <% end %> +
    ID<%= User.human_attribute_name :username %><%= t '.days_without_swaps' %><%= t '.last_movement' %>
    <%= mem.member_uid %><%= link_to mem.user.username, mem.user %><%= mem.days_without_swaps %><%= (mem.account.updated_at == mem.account.created_at) ? t(".no_movements") : l(mem.account.updated_at, format: :long) %>
    +
    +
    diff --git a/app/views/statistics/statistics_inactive_users.html.haml b/app/views/statistics/statistics_inactive_users.html.haml deleted file mode 100644 index ca623b9..0000000 --- a/app/views/statistics/statistics_inactive_users.html.haml +++ /dev/null @@ -1,18 +0,0 @@ -%h1= t("global.statistics") + ": " + t(".inactive_users") -.panel.panel-default - .panel-body - %table.table.table-hover.table-condensed - %thead - %tr - %th ID - %th= User.human_attribute_name(:username) - %th= t ".days_without_swaps" - %th= t ".last_movement" - %tbody - / Por días sin movimientos - - @members.includes(:account).sort_by(&:days_without_swaps).reverse.compact.each do |mem| - %tr - %td= mem.member_uid - %td= link_to mem.user.username, mem.user - %td= mem.days_without_swaps - %td= (mem.account.updated_at == mem.account.created_at) ? t(".no_movements") : l(mem.account.updated_at, format: :long) diff --git a/app/views/statistics/statistics_last_login.html.erb b/app/views/statistics/statistics_last_login.html.erb new file mode 100644 index 0000000..d2150e6 --- /dev/null +++ b/app/views/statistics/statistics_last_login.html.erb @@ -0,0 +1,25 @@ +

    + <%= t 'global.statistics' %>: <%= t '.last_login' %> +

    +
    +
    + + + + + + + + + + <% @members.each do |mem| %> + + + + + + <% end %> + +
    ID<%= User.human_attribute_name :username %><%= User.human_attribute_name :last_sign_in_at %>
    <%= mem.member_uid %><%= link_to mem.user.username, mem.user %><%= mem.user.current_sign_in_at.blank? ? t(".never_login") : l(mem.user.current_sign_in_at, format: :long) %>
    +
    +
    diff --git a/app/views/statistics/statistics_last_login.html.haml b/app/views/statistics/statistics_last_login.html.haml deleted file mode 100644 index a402202..0000000 --- a/app/views/statistics/statistics_last_login.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -%h1= t("global.statistics") + ": " + t(".last_login") -.panel.panel-default - .panel-body - %table.table.table-hover.table-condensed - %thead - %tr - %th ID - %th= User.human_attribute_name(:username) - %th= User.human_attribute_name(:last_sign_in_at) - %tbody - - @members.each do |mem| - %tr - %td= mem.member_uid - %td= link_to mem.user.username, mem.user - %td= mem.user.current_sign_in_at.blank? ? t(".never_login") : l(mem.user.current_sign_in_at, format: :long) diff --git a/app/views/statistics/statistics_type_swaps.html.erb b/app/views/statistics/statistics_type_swaps.html.erb new file mode 100644 index 0000000..cedb085 --- /dev/null +++ b/app/views/statistics/statistics_type_swaps.html.erb @@ -0,0 +1,28 @@ +

    + <%= t 'global.statistics' %>: <%= t '.type_of_swaps' %> +

    +
    +
    + + + + + + + + + + + <%# [["Clases", "clases", 13020, 3, 0.30], ["Domestic", "coche", 2220, 1, 0.1],...] %> + <% @offers.each do |offer| %> + + + + + + + <% end %> + +
    %<%= "#{Category.model_name.human} -> #{Offer.human_attribute_name(:tag_list)}" %><%= t 'statistics.statistics_global_activity.total_hours' %><%= t 'statistics.statistics_global_activity.num_swaps' %>
    <%= number_to_percentage offer.last * 100, precision: 2 %><%= "#{offer[0]} -> #{offer[1]}" %><%= seconds_to_hm offer[2] || '—' %><%= offer[3] %>
    +
    +
    diff --git a/app/views/statistics/statistics_type_swaps.html.haml b/app/views/statistics/statistics_type_swaps.html.haml deleted file mode 100644 index 902c016..0000000 --- a/app/views/statistics/statistics_type_swaps.html.haml +++ /dev/null @@ -1,20 +0,0 @@ -%h1= t("global.statistics") + ": " + t(".type_of_swaps") -.panel.panel-default - .panel-body - %table.table.table-hover.table-condensed - %thead - %tr - %th % - %th - = "#{Category.model_name.human} -> #{Offer.human_attribute_name(:tag_list)}" - %th= t "statistics.statistics_global_activity.total_hours" - %th= t "statistics.statistics_global_activity.num_swaps" - - %tbody - / [["Clases", "clases", 13020, 3, 0.30], ["Domestic", "coche", 2220, 1, 0.1],...] - - @offers.each do |offer| - %tr - %td= number_to_percentage(offer.last*100, precision: 2) - %td= "#{offer[0]} -> #{offer[1]}" - %td= seconds_to_hm(offer[2] || mdash) - %td= offer[3] diff --git a/app/views/statistics/statistics_without_offers.html.erb b/app/views/statistics/statistics_without_offers.html.erb new file mode 100644 index 0000000..4b61a62 --- /dev/null +++ b/app/views/statistics/statistics_without_offers.html.erb @@ -0,0 +1,23 @@ +

    + <%= t 'global.statistics' %>: <%= t '.without_offers' %> +

    +
    +
    + + + + + + + + + <% @members.reject { |mem| mem.offers.present? }.each do |mem| %> + + + + + <% end %> + +
    ID<%= User.human_attribute_name(:username) %>
    <%= mem.member_uid %><%= link_to mem.user.username, mem.user %>
    +
    +
    diff --git a/app/views/statistics/statistics_without_offers.html.haml b/app/views/statistics/statistics_without_offers.html.haml deleted file mode 100644 index 62d3ff2..0000000 --- a/app/views/statistics/statistics_without_offers.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -%h1= t("global.statistics") + ": " + t(".without_offers") -.panel.panel-default - .panel-body - %table.table.table-hover.table-condensed - %thead - %tr - %th ID - %th= User.human_attribute_name(:username) - %tbody - - @members.each do |mem| - - if mem.offers.blank? - %tr - %td= mem.member_uid - %td= link_to mem.user.username, mem.user diff --git a/app/views/tags/_grouped_index.html.erb b/app/views/tags/_grouped_index.html.erb new file mode 100644 index 0000000..3a0704d --- /dev/null +++ b/app/views/tags/_grouped_index.html.erb @@ -0,0 +1,24 @@ +
    + <% alpha_tags.each_slice(6) do |gr| %> +
    + <% gr.each do |kg, vg| %> +
    +

    + <%= kg %> +

    + <% vg.each do |tag, count| %> +

    +

    + <%= count %> +
    + <%= link_to get_index_path(post_type.pluralize, tag: tag) do %> + <%= glyph count == 1 ? :tag : :tags %> + <%= tag %> + <% end %> +

    + <% end %> +
    + <% end %> +
    + <% end %> +
    diff --git a/app/views/tags/_grouped_index.html.haml b/app/views/tags/_grouped_index.html.haml deleted file mode 100644 index 6bcaf12..0000000 --- a/app/views/tags/_grouped_index.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -.tag_list.container_fluid - - alpha_tags.each_slice(6) do |gr| - .row - - gr.each do |kg, vg| - .col-xs-2.col-md-2 - %h2.bg-info.text-center - = kg - - vg.each do |tag, count| - %p - .badge - = count - - path = get_index_path(post_type.pluralize, tag: tag) - = link_to path do - - gtag = (count == 1) ? "tag" : "tags" - = glyph(gtag) - = tag diff --git a/app/views/tags/alpha_grouped_index.html.erb b/app/views/tags/alpha_grouped_index.html.erb new file mode 100644 index 0000000..a9dc41d --- /dev/null +++ b/app/views/tags/alpha_grouped_index.html.erb @@ -0,0 +1,22 @@ +

    + <%= t '.maintitle' %> + <%= form_tag '/tags/alpha_grouped_index', method: :get do %> +
    + + +
    + <% end %> +

    +
    +
    + <%= render 'grouped_index', + alpha_tags: @alpha_tags, + post_type: params[:post_type] || 'offer' %> +
    +
    diff --git a/app/views/tags/alpha_grouped_index.html.haml b/app/views/tags/alpha_grouped_index.html.haml deleted file mode 100644 index 024c006..0000000 --- a/app/views/tags/alpha_grouped_index.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -%h1 - =t(".maintitle") - =form_tag '/tags/alpha_grouped_index', method: :get do - .btn-group{"data-toggle" => "buttons"} - %label.btn.btn-primary.active.switch_offer-js - = radio_button_tag 'switch_offer', 'offer', true - = Offer.model_name.human(count: :many) - %label.btn.btn-primary.switch_inquiry-js - = radio_button_tag 'switch_inquiry', 'inquiry' - = Inquiry.model_name.human(count: :many) - -.tag_management - .alpha_tag_list.col-xs-12.col-md-12 - = render 'grouped_index', alpha_tags: @alpha_tags, post_type: params[:post_type] || "offer" diff --git a/app/views/terms/show.html.erb b/app/views/terms/show.html.erb new file mode 100644 index 0000000..eed77c8 --- /dev/null +++ b/app/views/terms/show.html.erb @@ -0,0 +1,13 @@ + + +<%= m @document.content %> + +<%= form_tag accept_terms_path, method: :post do %> + +<% end %> diff --git a/app/views/terms/show.html.haml b/app/views/terms/show.html.haml deleted file mode 100644 index 6e75e81..0000000 --- a/app/views/terms/show.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -%header.page-header - %h1= @document.title - -:markdown - #{@document.content} - -= form_tag accept_terms_path, method: :post do - %button.btn{type: :submit} - =t(".accept") diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb new file mode 100644 index 0000000..12f13ba --- /dev/null +++ b/app/views/users/_form.html.erb @@ -0,0 +1,40 @@ +<%= show_error_messages!(@user) %> +<%= simple_form_for @user do |f| %> +
    + <%= f.input :username %> + <% if admin? %> + <%= f.input :email %> + <% if @user.unconfirmed_email.present? %> + <%= f.input :unconfirmed_email, readonly: true %> + <% end %> + <% else %> + <%= f.input :email, readonly: true %> + <% end %> + <%# if current_user.try :superadmin? %> + <%#= f.association :organization, include_blank: false %> + <%#= f.input :superadmin, as: :boolean, label: false, inline_label: true %> + <%# end %> + <%# if current_user.try :admin? %> + <%#= f.input :admin, as: :boolean, label: false, inline_label: true, hint: t(".admin_warning") %> + <%# end %> + <%= f.input :phone %> + <%= f.input :alt_phone %> + <%= f.input :date_of_birth, + start_year: Date.today.year - 90, + end_year: Date.today.year - 12, + include_blank: :true %> + <%= f.input :description, as: "text" %> + <%#= f.association :categories, label_method: :fqn, input_html: {style: 'width: 100%'} %> +
    + <%= f.label :notifications %> + <%= f.check_box :notifications %> +
    +
    +
    + <%= f.button :submit %> + <% if @user.new_record? %> + <%= f.button :submit, t('users.new.create_more_users_button'), name: 'more' %> + <% end %> + <%= link_to t('users.new.cancel'), users_path, class: "btn btn-default" %> +
    +<% end %> diff --git a/app/views/users/_form.html.haml b/app/views/users/_form.html.haml deleted file mode 100644 index e3977cb..0000000 --- a/app/views/users/_form.html.haml +++ /dev/null @@ -1,35 +0,0 @@ -= show_error_messages!(@user) -= simple_form_for @user do |f| - .form-inputs - - = f.input :username - - - if admin? - = f.input :email - - if @user.unconfirmed_email.present? - = f.input :unconfirmed_email, readonly: true - - else - = f.input :email, readonly: true - - / - if current_user.try :superadmin? - / = f.association :organization, include_blank: false - / = f.input :superadmin, :as => :boolean, :label => false, :inline_label => true - / - if current_user.try :admin? - / = f.input :admin, :as => :boolean, :label => false, :inline_label => true, hint: t(".admin_warning") - - = f.input :phone - = f.input :alt_phone - = f.input :date_of_birth, start_year: Date.today.year - 90, end_year: Date.today.year - 12, include_blank: :true - - = f.input :description, as: "text" - / = f.association :categories, label_method: :fqn, input_html: {style: 'width: 100%'} - - .checkbox - = f.label :notifications - = f.check_box :notifications - - .form-actions - = f.button :submit - - if @user.new_record? - = f.button :submit, t('users.new.create_more_users_button'), name: 'more' - = link_to t('users.new.cancel'), users_path, class: "btn btn-default" diff --git a/app/views/users/_user_rows.html.erb b/app/views/users/_user_rows.html.erb new file mode 100644 index 0000000..90aa157 --- /dev/null +++ b/app/views/users/_user_rows.html.erb @@ -0,0 +1,64 @@ + + + + + {{user.member_id}} + + + {{user.username}} + + + + {{user.email}} + + + {{user.unconfirmed_email}} + + + {{user.phone}} + {{user.alt_phone}} + {{user.balance | timeBalance}} + <% if current_user.manages?(current_organization) %> + + + <%= glyph :pencil %> + <%= t "global.edit" %> + + "> + <%= glyph :ban_circle %> + <%= t "global.cancel_membership" %> + + + + <%= glyph :arrow_down %> + <%= t "global.demote" %> + + + <%= glyph :arrow_up %> + <%= t "global.promote" %> + + + + + <%= glyph :remove %> + <%= t ".deactivate" %> + + + <%= glyph :ok %> + <%= t ".activate" %> + + + + <% end %> + diff --git a/app/views/users/_user_rows.html.haml b/app/views/users/_user_rows.html.haml deleted file mode 100644 index dcf13d2..0000000 --- a/app/views/users/_user_rows.html.haml +++ /dev/null @@ -1,41 +0,0 @@ -%tr{ "ng-repeat" => "user in users | orderBy:sort | filter:filterTerm", "ng-class" => "{'bg-danger': !user.active}" } - %td - %img{ "ng-src" => "{{user.avatar}}", height: "32px", width: "32px" } - %td {{user.member_id}} - %td - %span.glyphicon.glyphicon-time{ "ng-if" => "!user.active" } - %a{ "ng-href" => "{{user.url}}" } - {{user.username}} - %td - %a{ "ng-href" => "mailto:{{user.email}}", ng_if: "!user.unconfirmed_email"} - {{user.email}} - %a{ng_href: "mailto:{{user.unconfirmed_email}}", ng_if: "user.unconfirmed_email"} - {{user.unconfirmed_email}} - %td {{user.phone}} - %td {{user.alt_phone}} - %td {{user.balance | timeBalance}} - - if current_user.manages? current_organization - %td.hover-actions - %a.action{ "ng-if" => "user.edit_link", "ng-href" => "{{user.edit_link}}"} - %span.glyphicon.glyphicon-pencil - = t "global.edit" - - %a.action{ "ng-if" => "user.cancel_link && !user.active", "ng-href" => "{{user.cancel_link}}", :data => {:method => :delete, :confirm => t('.cancel_warning', :user => "{{user.username}}")}} - %span.glyphicon.glyphicon-ban-circle - = t "global.cancel_membership" - - %a.action{ href: "", "ng-if" => "user.toggle_manager_link && user.active", "ng-click" => "toggle_manager(user)"} - %span{ "ng-if" => "user.manager" } - .glyphicon.glyphicon-arrow-down - = t "global.demote" - %span{ "ng-if" => "!user.manager" } - .glyphicon.glyphicon-arrow-up - = t "global.promote" - - %a.action{ href: "", "ng-if" => "user.toggle_active_link", "ng-click" => "toggle_active(user)"} - %span{ "ng-if" => "user.active" } - .glyphicon.glyphicon-remove - = t ".deactivate" - %span{ "ng-if" => "!user.active" } - .glyphicon.glyphicon-ok - = t ".activate" \ No newline at end of file diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb new file mode 100644 index 0000000..75e1c9a --- /dev/null +++ b/app/views/users/edit.html.erb @@ -0,0 +1,6 @@ +

    + <%= @user.username %> + <%= t ".edit_user" %> +

    + +<%= render "form" %> diff --git a/app/views/users/edit.html.haml b/app/views/users/edit.html.haml deleted file mode 100644 index 3ec9c3d..0000000 --- a/app/views/users/edit.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -%h1 - = @user.username - %small - = t ".edit_user" - -= render "form" diff --git a/app/views/users/give_time.html.erb b/app/views/users/give_time.html.erb new file mode 100644 index 0000000..2b5b143 --- /dev/null +++ b/app/views/users/give_time.html.erb @@ -0,0 +1,66 @@ +

    + + <%= t ".give_time" %> + + <%= link_to @user.member(current_organization).display_name_with_uid, user_path(@user) %> +

    +<% if @offer %> +

    + <%= @offer %> +

    +<% end %> +<%= simple_form_for @transfer do |f| %> +
    + <%= f.input :hours, + as: :integer, + input_html: { + min: 0, + max: 20, + "data-rule-either-hours-minutes-informed" => "true", + "data-rule-range" => "[0,20]" + } %> + <%= f.input :minutes, + as: :integer, + input_html: { + min: 0, + max: 59, + step: 15, + "data-rule-either-hours-minutes-informed" => "true", + "data-rule-range" => "[0,59]" + } %> + <%= f.input :amount, as: :hidden %> + <%= f.input :reason %> + <%= f.input :destination, as: :hidden %> + <% if admin? %> +
    + <%= f.label :source %> + <%= f.select :source, + options_for_select( + @sources.sort_by { |source| [source.accountable_type, source.accountable.try(:member_uid)] } + .map { |a| ["#{a.accountable_type == "Member" ? a.accountable.member_uid : ""} #{a.accountable_type} #{a.accountable.to_s}", a.id] }, + selected: current_user.member(current_organization).account.id + ), + {}, + id: "select2-time", + class: "form-control" %> +
    + <% end %> + <% if @offer %> + <%= f.input :post, readonly: true %> + <%= f.input :post_id, as: :hidden %> + <% else %> + <%= f.input :post_id, collection: @user.member(current_organization).offers.active %> + <% end %> +
    +
    + <%= f.button :submit, class: "btn btn-default", style: "margin-bottom: 20px;" %> +
    +<% end %> + + diff --git a/app/views/users/give_time.html.haml b/app/views/users/give_time.html.haml deleted file mode 100644 index 9c0e38d..0000000 --- a/app/views/users/give_time.html.haml +++ /dev/null @@ -1,33 +0,0 @@ -%h1 - %small= t ".give_time" - = link_to @user.member(current_organization).display_name_with_uid, user_path(@user) - -- if @offer - %h3= @offer - -= simple_form_for @transfer do |f| - .form-inputs - = f.input :hours, as: :integer, input_html: { min: 0, max: 20, "data-rule-either-hours-minutes-informed" => "true", "data-rule-range" => "[0,20]"} - = f.input :minutes, as: :integer, input_html: { min: 0, max: 59, step: 15, "data-rule-either-hours-minutes-informed" => "true", "data-rule-range" => "[0,59]"} - = f.input :amount, as: :hidden - = f.input :reason - = f.input :destination, as: :hidden - - if admin? - .form-group - = f.label :source - = f.select :source, options_for_select(@sources.sort_by{ |source| [source.accountable_type, source.accountable.try(:member_uid)]}.map{ |a| ["#{a.accountable_type == "Member" ? a.accountable.member_uid : ""} #{a.accountable_type} #{a.accountable.to_s}", a.id]}, selected: current_user.member(current_organization).account.id), {}, { id: "select2-time", class: "form-control" } - - if @offer - = f.input :post, readonly: true - = f.input :post_id, as: :hidden - - else - = f.input :post_id, collection: @user.member(current_organization).offers.active - - .form-actions - = f.button :submit, class: "btn btn-default", style: "margin-bottom: 20px;" - -:javascript - $("#select2-time").select2({ - formatNoMatches: function() { - return "#{t 'application.tips.user_not_found'}"; - } - }) diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb new file mode 100644 index 0000000..546e630 --- /dev/null +++ b/app/views/users/index.html.erb @@ -0,0 +1,113 @@ +
    +

    + <%= User.model_name.human.pluralize %> + — + <%= link_to current_organization.name, + organization_path(current_organization) %> + <% if params[:q].present? %> + + <%= glyph :search %> + <%= params[:q] %> + + <% end %> +

    + +
    + + + + + + + + + + + + <% if current_user.manages? current_organization %> + + <% end %> + + + + <%= render "user_rows", users: @users %> + +
    + + ID + + + + + + <%= User.human_attribute_name(:username) %> + + + + + + <%= User.human_attribute_name(:email) %> + + + + + <%= User.human_attribute_name(:phone) %> + + <%= User.human_attribute_name(:alt_phone) %> + + + <%= Account.human_attribute_name(:balance) %> + + + + + + <%= t(".actions") %> +
    +
    +
    + + + + + + diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml deleted file mode 100644 index 07855bc..0000000 --- a/app/views/users/index.html.haml +++ /dev/null @@ -1,71 +0,0 @@ -%div{"ng-controller" => "UserListCtrl"} - %h1 - = User.model_name.human.pluralize - — - = link_to current_organization.name, organization_path(current_organization) - - if params[:q].present? - %small - %span.glyphicon.glyphicon-search - = params[:q] - - .navbar - %form.navbar-form.navbar-left - %input.form-control{type: "text", placeholder: t("global.search"), "ng-model" => "filterTerm"} - %ul.nav.navbar-nav.pull-right - - if admin? - %li - %a{href: new_user_path} - %span.glyphicon.glyphicon-plus - = t "helpers.submit.create", model: User.model_name.human - - %table.table.table-hover.table-condensed.users.panel{"ng-cloak"=>""} - %thead - %tr - %tr - %th - %th - %a{ href: "", ng_click: "sortBy('member_id')" } - ID - %span.glyphicon.glyphicon-chevron-down{ ng_if: "sort == '-member_id'" } - %span.glyphicon.glyphicon-chevron-up{ ng_if: "sort == 'member_id'" } - %th - %a{ href: "", ng_click: "sortBy('username')" } - = User.human_attribute_name(:username) - %span.glyphicon.glyphicon-chevron-down{ ng_if: "sort == '-username'" } - %span.glyphicon.glyphicon-chevron-up{ ng_if: "sort == 'username'" } - %th - %a{ href: "", ng_click: "sortBy('email')" } - = User.human_attribute_name(:email) - %span.glyphicon.glyphicon-chevron-down{ ng_if: "sort == '-email'" } - %span.glyphicon.glyphicon-chevron-up{ ng_if: "sort == 'email'" } - %th= User.human_attribute_name(:phone) - %th= User.human_attribute_name(:alt_phone) - %th - %a{ href: "", ng_click: "sortBy('balance')" } - = Account.human_attribute_name(:balance) - %span.glyphicon.glyphicon-chevron-down{ ng_if: "sort == '-balance'" } - %span.glyphicon.glyphicon-chevron-up{ ng_if: "sort == 'balance'" } - - if current_user.manages? current_organization - %th - %span.glyphicon.glyphicon-hand-down - =t(".actions") - - %tbody - = render partial: "user_rows", locals: {users: @users} - -%script{type: "text/ng-template", id: "confirm_toggle_manager.html"} - .modal-body= t('.manage_warning_angular') - .modal-footer - %button.btn.btn-primary{"ng-click" => "$close(true)"} OK - %button.btn.btn-warning{"ng-click" => "$dismiss()"} NO - -%script{type: "text/ng-template", id: "confirm_toggle_active.html"} - .modal-body= t('.active_warning_angular') - .modal-footer - %button.btn.btn-primary{"ng-click" => "$close(true)"} OK - %button.btn.btn-warning{"ng-click" => "$dismiss()"} NO - -:javascript - angular.module("timeoverflow").run(function ($rootScope, $location, $http, $modal) { - $rootScope.users = #{ users_as_json }; - }); diff --git a/app/views/users/index.js.erb b/app/views/users/index.js.erb new file mode 100644 index 0000000..8652f5c --- /dev/null +++ b/app/views/users/index.js.erb @@ -0,0 +1,2 @@ +$('table.users tbody').append("<%= j(render 'users/user_rows', users: @users) %>"); +$('table.users a[rel=next]').replaceWith("<%= link_to_next_page @users, t('.more'), remote: true, class: 'btn btn-default', params: params %>"); diff --git a/app/views/users/index.js.haml b/app/views/users/index.js.haml deleted file mode 100644 index 4247293..0000000 --- a/app/views/users/index.js.haml +++ /dev/null @@ -1,2 +0,0 @@ -$('table.users tbody').append('#{escape_javascript(render partial: "users/user_rows", locals: { users: @users })}'); -$('table.users a[rel=next]').replaceWith('#{link_to_next_page @users, t('.more'), remote: true, class: "btn btn-default", params: params}'); diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb new file mode 100644 index 0000000..6f2b038 --- /dev/null +++ b/app/views/users/new.html.erb @@ -0,0 +1,4 @@ +

    + <%= t ".new_user" %> +

    +<%= render "form" %> diff --git a/app/views/users/new.html.haml b/app/views/users/new.html.haml deleted file mode 100644 index 43d8a0e..0000000 --- a/app/views/users/new.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -%h1= t ".new_user" - -= render "form" \ No newline at end of file diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb new file mode 100644 index 0000000..5309368 --- /dev/null +++ b/app/views/users/show.html.erb @@ -0,0 +1,166 @@ +
    +
    +

    + + <% unless @member.active %> + <%= t ".inactive" %> + <% end %> + + <%= @member.display_name_with_uid %> + + <% if @user.superadmin? %> + + <%= t ".superadmin" %> + + <% end %> + +

    +
    +
    + <% if @user == current_user %> + + <%= image_tag avatar_url(@user, 160) %> + + <% else %> + <%= image_tag avatar_url(@user, 160) %> + <% end %> +
    +
    + <%= m @user.description %> + +
    +

    + <%= t "global.contact_details" %> +

    + <% if @user.email_if_real != "" %> +
    + <%= User.human_attribute_name(:email) %> +
    +
    + <%= @user.email_if_real %> +
    + <% end %> + <% phones = [@user.phone, @user.alt_phone].select(&:present?) %> + <% if phones.present? %> +
    + <%= t(".phone", count: phones.size) %> +
    +
    + <%= phones.map(&:to_s).join('—') %> +
    + <% end %> +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    + <%= Offer.model_name.human(count: :many) %> + <% if @user == current_user %> + + <%= glyph :plus %> + + <% end %> +

    +
    + <% @member.offers.active.each do |post| %> +
    +
    + <%= link_to post, post %> +
    +
    + <%= strip_tags(post.rendered_description.to_html) %> +
    +
    + <%= link_to glyph(:time), + give_time_user_path(@user, offer: post.id), + title: t("global.give_time") %> +
    +
    + <% end %> + +
    +
    +
    +
    +
    +

    + <%= Inquiry.model_name.human(count: :many) %> + <% if @user == current_user %> + + <%= glyph :plus %> + + <% end %> +

    +
    + <% @member.inquiries.active.each do |post| %> +
    +
    + <%= link_to post, post %> +
    +
    + <%= strip_tags(post.rendered_description.to_html) %> +
    +
    + <% end %> + +
    +
    +
    +
    +
    +
    +
    +

    + <%= t(".accounts") %> +

    +
    +
    + <% if @member.manager %> +

    + ADMIN +

    + <% end %> +

    + + <%= t(".created_at") %> + + <%= @member.entry_date ? l(@member.entry_date, format: :long) : mdash %> +
    + + <%= t(".user_no") %> + + <%= @member.member_uid || mdash %> +
    + + <%= t(".balance") %> + <%= seconds_to_hm(@member.account.try(:balance) || mdash) %> + +

    +
    +
    +
    +
    + +<%= render 'shared/movements' %> diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml deleted file mode 100644 index 580b5b4..0000000 --- a/app/views/users/show.html.haml +++ /dev/null @@ -1,110 +0,0 @@ -.panel.user-profile - .panel-body - %h1 - %small - - unless @member.active - = t ".inactive" - = @member.display_name_with_uid - %small - - if @user.superadmin? - %span.label.label-important= t ".superadmin" - - .row - .col-sm-3.col-xs-5.text-center - - if @user == current_user - %a{href: "https://www.gravatar.com", target: "_blank"} - = image_tag avatar_url(@user, 160) - - else - = image_tag avatar_url(@user, 160) - - .col-sm-9.col-xs-7 - :markdown - #{@user.description} - - %ul.nav.nav-pills.pull-right - - if @user == current_user - %li - %a{href: edit_user_path(@user)} - %span.glyphicon.glyphicon-pencil - = t "global.edit" - - if admin? || @user != current_user - %li - %a{href: give_time_user_path(@user)} - %span.glyphicon.glyphicon-time - = t "global.give_time" - - - %dl.dl-horizontal - %h3 - = t "global.contact_details" - - if @user.email_if_real != "" - %dt= User.human_attribute_name(:email) - %dd= @user.email_if_real - - phones = [@user.phone, @user.alt_phone].map(&:presence).compact - - if phones.present? - %dt= t(".phone", count: phones.size) - %dd - - phones.each_with_index do |ph, idx| - - unless idx.zero? - — - = ph - -.row - .col-sm-6.offers - .panel.panel-default - .panel-heading - %h2.panel-title - = Offer.model_name.human(count: :many) - - if @user == current_user - %a.pull-right{href: new_offer_path} - %span.glyphicon.glyphicon-plus - - - %table.table.table-condensed.offers - - @member.offers.active.each do |post| - %tr - %td= link_to post, post - %td= strip_tags(post.rendered_description.to_html) - %td - %a{href: give_time_user_path(@user, offer: post.id), title: t("global.give_time")} - %span.glyphicon.glyphicon-time - - .col-sm-6.inquiries - .panel.panel-default - .panel-heading - %h2.panel-title - = Inquiry.model_name.human(count: :many) - - if @user == current_user - %a.pull-right{href: new_inquiry_path} - %span.glyphicon.glyphicon-plus - - %table.table.table-condensed.offers - - @member.inquiries.active.each do |post| - %tr - %td= link_to post, post - %td= strip_tags(post.rendered_description.to_html) - -.row - .col-sm-4 - .panel.panel-default - .panel-heading - %h3.panel-title - = t(".accounts") - .panel-body - - if @member.manager - %p.danger - ADMIN - %p - %strong - = t(".created_at") - = @member.entry_date ? l(@member.entry_date, format: :long) : mdash - %br - %strong - = t(".user_no") - = @member.member_uid || mdash - %br - %strong.lead{ class: green_red(@member.account&.balance) } - = t(".balance") - = seconds_to_hm(@member.account.try(:balance) || mdash) - -= render "shared/movements" diff --git a/config/deploy.rb b/config/deploy.rb index e8a80c7..f7943b6 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -1,8 +1,8 @@ # config valid only for current version of Capistrano -lock "3.4.0" +lock '3.4.0' -set :application, "timeoverflow" -set :repo_url, "git@github.com:coopdevs/timeoverflow.git" +set :application, 'timeoverflow' +set :repo_url, 'git@github.com:coopdevs/timeoverflow.git' # Default branch is :master # ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp @@ -26,17 +26,17 @@ set :repo_url, "git@github.com:coopdevs/timeoverflow.git" set :linked_files, fetch(:linked_files, []).push( # "config/database.yml", # "config/secrets.yml", - ".env", + # ".env", ) # Default value for linked_dirs is [] set :linked_dirs, fetch(:linked_dirs, []).push( - "log", - "tmp/pids", - "tmp/cache", - "tmp/sockets", - "vendor/bundle", - "public/system" + 'log', + 'tmp/pids', + 'tmp/cache', + 'tmp/sockets', + 'vendor/bundle', + 'public/system' ) # Default value for default_env is {} diff --git a/config/deploy/production.rb b/config/deploy/production.rb index 13da887..a740b3a 100644 --- a/config/deploy/production.rb +++ b/config/deploy/production.rb @@ -1 +1 @@ -server "metal.timeoverflow.org", user: "deploy", roles: %w{app db web} +server 'metal.timeoverflow.org', user: 'timeoverflow', roles: %w(app db web) diff --git a/lib/templates/haml/scaffold/_form.html.haml b/lib/templates/haml/scaffold/_form.html.haml deleted file mode 100644 index ac3aa7b..0000000 --- a/lib/templates/haml/scaffold/_form.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -= simple_form_for(@<%= singular_table_name %>) do |f| - = f.error_notification - - .form-inputs - <%- attributes.each do |attribute| -%> - = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> - <%- end -%> - - .form-actions - = f.button :submit