diff --git a/README.md b/README.md index 87e0d1ab9..a3433df9d 100644 --- a/README.md +++ b/README.md @@ -27,13 +27,13 @@ cd participacion bundle install cp config/database.yml.example config/database.yml cp config/secrets.yml.example config/secrets.yml -bundle exec bin/rake db:setup -RAILS_ENV=test bundle exec rake db:setup +bin/rake db:setup +RAILS_ENV=test bin/rake db:setup ``` Para ejecutar la aplicación en local: ``` -bundle exec bin/rails s +bin/rails s ``` Prerequisitos para los tests: tener instalado PhantomJS >= 2.0 @@ -41,7 +41,7 @@ Prerequisitos para los tests: tener instalado PhantomJS >= 2.0 Para ejecutar los tests: ``` -bundle exec bin/rspec +bin/rspec ``` ### OAuth diff --git a/README_EN.md b/README_EN.md index 9ebc58731..a3dd63106 100644 --- a/README_EN.md +++ b/README_EN.md @@ -28,13 +28,13 @@ cd participacion bundle install cp config/database.yml.example config/database.yml cp config/secrets.yml.example config/secrets.yml -bundle exec bin/rake db:setup -RAILS_ENV=test bundle exec rake db:setup +bin/rake db:setup +RAILS_ENV=test bin/rake db:setup ``` Run the app locally: ``` -bundle exec bin/rails s +bin/rails s ``` Prerequisites for testing: install PhantomJS >= 2.0 @@ -42,7 +42,7 @@ Prerequisites for testing: install PhantomJS >= 2.0 Run the tests with: ``` -bundle exec bin/rspec +bin/rspec ``` ## Licence diff --git a/app/assets/fonts/icons.eot b/app/assets/fonts/icons.eot index 2c00f1f5b..a1cc83d43 100644 Binary files a/app/assets/fonts/icons.eot and b/app/assets/fonts/icons.eot differ diff --git a/app/assets/fonts/icons.svg b/app/assets/fonts/icons.svg index 2f04723b8..049938913 100644 --- a/app/assets/fonts/icons.svg +++ b/app/assets/fonts/icons.svg @@ -29,4 +29,5 @@ + diff --git a/app/assets/fonts/icons.ttf b/app/assets/fonts/icons.ttf index 808c75487..aa9c63faa 100644 Binary files a/app/assets/fonts/icons.ttf and b/app/assets/fonts/icons.ttf differ diff --git a/app/assets/fonts/icons.woff b/app/assets/fonts/icons.woff index cc9c32cdf..b17f63445 100644 Binary files a/app/assets/fonts/icons.woff and b/app/assets/fonts/icons.woff differ diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss index 7e6096bc3..5afa088d1 100644 --- a/app/assets/stylesheets/admin.scss +++ b/app/assets/stylesheets/admin.scss @@ -140,7 +140,7 @@ body.admin { .delete { border-bottom: 1px dotted #CF2A0E; - color: #F04124; + color: $delete; font-size: rem-calc(12); &:hover, &:active, &:focus { @@ -151,16 +151,27 @@ body.admin { .verified { color: $check; + + a { + border-bottom: 1px dotted $check; + color: $check; + font-size: rem-calc(12); + } } -.verified a { - border-bottom: 1px dotted $check; - color: $check; +.archived { + color: $text-medium; font-size: rem-calc(12); } .rejected { - color: #F04124; + color: $delete; +} + +.date { + color: $text-medium; + font-size: rem-calc(12); + font-style: italic; } .level { diff --git a/app/assets/stylesheets/debates.scss b/app/assets/stylesheets/debates.scss index 66ea491af..641e7ccff 100644 --- a/app/assets/stylesheets/debates.scss +++ b/app/assets/stylesheets/debates.scss @@ -5,6 +5,7 @@ // 03. Show // 04. New // 05. Comments +// 06. Flags // // 01. Debates @@ -541,6 +542,10 @@ font-size: rem-calc(12); margin: rem-calc(6) 0; padding: rem-calc(6); + + .divider { + color: $text-light; + } } .comment-user { @@ -608,3 +613,17 @@ .faded { opacity: 0.4; } + +// 06. Flags +// - - - - - - - - - - - - - - - - - - - - - - - - - + +.flag-disable { + color: $text-medium; + line-height: rem-calc(24); + vertical-align: middle; +} + +.flag-active { + @extend .flag-disable; + color: $delete; +} diff --git a/app/assets/stylesheets/icons.scss b/app/assets/stylesheets/icons.scss index ac6bb9dab..6a014579c 100644 --- a/app/assets/stylesheets/icons.scss +++ b/app/assets/stylesheets/icons.scss @@ -103,3 +103,7 @@ .icon-x:before { content: "v"; } +.icon-flag:before { + content: "w"; +} + diff --git a/app/assets/stylesheets/participacion.scss b/app/assets/stylesheets/participacion.scss index 485dbfd60..e20a2cb36 100644 --- a/app/assets/stylesheets/participacion.scss +++ b/app/assets/stylesheets/participacion.scss @@ -135,6 +135,7 @@ h1, h2, h3, h4, h5, h6 { } .sub-nav dt, .sub-nav dd, .sub-nav li { + padding: rem-calc(3) 0; &.active { background: #008CBA; @@ -142,7 +143,7 @@ h1, h2, h3, h4, h5, h6 { color: white; cursor: default; font-weight: normal; - padding: 0.16667rem 0.88889rem; + padding: rem-calc(3) rem-calc(14); a:hover { color: #737373; @@ -150,6 +151,37 @@ h1, h2, h3, h4, h5, h6 { } } +.f-dropdown { + li a { + font-size: rem-calc(12); + + &:hover { + color: $link-hover; + } + } + + li:hover, .f-dropdown li:focus { + background: white; + } + + &.open { + outline: none; + } +} + +.margin { + margin-top: $line-height; + margin-bottom: $line-height; +} + +.margin-top { + margin-top: $line-height; +} + +.margin-bottom { + margin-bottom: $line-height; +} + // 04. Header // - - - - - - - - - - - - - - - - - - - - - - - - - @@ -494,9 +526,14 @@ footer { h2 { clear: both; - font-size: rem-calc(30); + font-size: rem-calc(18); font-weight: bold; - line-height: $line-height*2; + line-height: $line-height; + + @media (min-width: $small-breakpoint) { + font-size: rem-calc(30); + line-height: $line-height*2; + } } .back, .icon-angle-left { @@ -692,13 +729,13 @@ form { } } -img.admin-avatar, img.moderator-avatar { +img.avatar, img.admin-avatar, img.moderator-avatar { border-radius: rem-calc(1000); position: relative; } img.initialjs-avatar { - @extend .moderator-avatar; + @extend .avatar; } .author-deleted { diff --git a/app/assets/stylesheets/variables.scss b/app/assets/stylesheets/variables.scss index 4be7028e3..6240702d2 100644 --- a/app/assets/stylesheets/variables.scss +++ b/app/assets/stylesheets/variables.scss @@ -38,6 +38,7 @@ $votes-like-act: #5D9E7F; $votes-unlike: #EF8585; $votes-unlike-act: #BD6A6A; +$delete: #F04124; $check: #46DB91; // 03. Forms @@ -84,6 +85,7 @@ $comment-official: rgba(70,219,145,.3); // 06. Responsive // - - - - - - - - - - - - - - - - - - - - - - - - - +$small: em-calc(480); $small-breakpoint: em-calc(640); $medium-breakpoint: em-calc(1024); $large-breakpoint: em-calc(1440); diff --git a/app/controllers/moderation/comments_controller.rb b/app/controllers/moderation/comments_controller.rb index 03667e286..8a4d3768e 100644 --- a/app/controllers/moderation/comments_controller.rb +++ b/app/controllers/moderation/comments_controller.rb @@ -19,8 +19,8 @@ class Moderation::CommentsController < Moderation::BaseController redirect_to request.query_parameters.merge(action: :index) end - def mark_as_reviewed - @comment.mark_as_reviewed + def archive + @comment.archive redirect_to request.query_parameters.merge(action: :index) end @@ -31,7 +31,7 @@ class Moderation::CommentsController < Moderation::BaseController end def set_valid_filters - @valid_filters = %w{all pending_review reviewed} + @valid_filters = %w{all pending archived} end def parse_filter diff --git a/app/controllers/moderation/debates_controller.rb b/app/controllers/moderation/debates_controller.rb index 22e4eac6b..3492ee423 100644 --- a/app/controllers/moderation/debates_controller.rb +++ b/app/controllers/moderation/debates_controller.rb @@ -19,8 +19,8 @@ class Moderation::DebatesController < Moderation::BaseController redirect_to request.query_parameters.merge(action: :index) end - def mark_as_reviewed - @debate.mark_as_reviewed + def archive + @debate.archive redirect_to request.query_parameters.merge(action: :index) end @@ -31,7 +31,7 @@ class Moderation::DebatesController < Moderation::BaseController end def set_valid_filters - @valid_filters = %w{all pending_review reviewed} + @valid_filters = %w{all pending archived} end def parse_filter diff --git a/app/controllers/organizations/registrations_controller.rb b/app/controllers/organizations/registrations_controller.rb index 8602ba4ba..630cc64e4 100644 --- a/app/controllers/organizations/registrations_controller.rb +++ b/app/controllers/organizations/registrations_controller.rb @@ -5,6 +5,9 @@ class Organizations::RegistrationsController < Devise::RegistrationsController end end + def success + end + def create build_resource(sign_up_params) if resource.valid_with_captcha? @@ -17,6 +20,11 @@ class Organizations::RegistrationsController < Devise::RegistrationsController end end + protected + def after_inactive_sign_up_path_for(resource) + organizations_sign_up_success_path + end + private def sign_up_params diff --git a/app/models/ability.rb b/app/models/ability.rb index a29f09a60..c8ed63d22 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -53,14 +53,14 @@ class Ability can :hide, Comment, hidden_at: nil cannot :hide, Comment, user_id: user.id - can :mark_as_reviewed, Comment, reviewed_at: nil, hidden_at: nil - cannot :mark_as_reviewed, Comment, user_id: user.id + can :archive, Comment, archived_at: nil, hidden_at: nil + cannot :archive, Comment, user_id: user.id can :hide, Debate, hidden_at: nil cannot :hide, Debate, author_id: user.id - can :mark_as_reviewed, Debate, reviewed_at: nil, hidden_at: nil - cannot :mark_as_reviewed, Debate, author_id: user.id + can :archive, Debate, archived_at: nil, hidden_at: nil + cannot :archive, Debate, author_id: user.id can :hide, User cannot :hide, User, id: user.id diff --git a/app/models/comment.rb b/app/models/comment.rb index a9dc68505..dca894b7c 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -18,8 +18,8 @@ class Comment < ActiveRecord::Base scope :recent, -> { order(id: :desc) } scope :sorted_for_moderation, -> { order(inappropiate_flags_count: :desc, updated_at: :desc) } - scope :pending_review, -> { where(reviewed_at: nil, hidden_at: nil) } - scope :reviewed, -> { where("reviewed_at IS NOT NULL AND hidden_at IS NULL") } + scope :pending, -> { where(archived_at: nil, hidden_at: nil) } + scope :archived, -> { where("archived_at IS NOT NULL AND hidden_at IS NULL") } scope :flagged_as_inappropiate, -> { where("inappropiate_flags_count > 0") } def self.build(commentable, user, body) @@ -64,8 +64,8 @@ class Comment < ActiveRecord::Base hidden? || user.hidden? end - def reviewed? - reviewed_at.present? + def archived? + archived_at.present? end def as_administrator? @@ -76,8 +76,8 @@ class Comment < ActiveRecord::Base moderator_id.present? end - def mark_as_reviewed - update(reviewed_at: Time.now) + def archive + update(archived_at: Time.now) end # TODO: faking counter cache since there is a bug with acts_as_nested_set :counter_cache diff --git a/app/models/debate.rb b/app/models/debate.rb index 2f93dfa2b..7b43bc71c 100644 --- a/app/models/debate.rb +++ b/app/models/debate.rb @@ -24,8 +24,8 @@ class Debate < ActiveRecord::Base before_validation :sanitize_tag_list scope :sorted_for_moderation, -> { order(inappropiate_flags_count: :desc, updated_at: :desc) } - scope :pending_review, -> { where(reviewed_at: nil, hidden_at: nil) } - scope :reviewed, -> { where("reviewed_at IS NOT NULL AND hidden_at IS NULL") } + scope :pending, -> { where(archived_at: nil, hidden_at: nil) } + scope :archived, -> { where("archived_at IS NOT NULL AND hidden_at IS NULL") } scope :flagged_as_inappropiate, -> { where("inappropiate_flags_count > 0") } # Ahoy setup @@ -74,12 +74,12 @@ class Debate < ActiveRecord::Base count < 0 ? 0 : count end - def reviewed? - reviewed_at.present? + def archived? + archived_at.present? end - def mark_as_reviewed - update(reviewed_at: Time.now) + def archive + update(archived_at: Time.now) end protected diff --git a/app/views/comments/_actions.html.erb b/app/views/comments/_actions.html.erb index 5454179f0..51a6743e0 100644 --- a/app/views/comments/_actions.html.erb +++ b/app/views/comments/_actions.html.erb @@ -1,12 +1,16 @@ + + <%= render 'comments/flag_as_inappropiate_actions', comment: comment %> + + <% if can? :hide, comment %> -  |  +  •  <%= link_to t("admin.actions.hide").capitalize, hide_moderation_comment_path(comment), method: :put, remote: true, data: { confirm: t('admin.actions.confirm') } %> <% end %> <% if can? :hide, comment.user %> -  |  +  •  <%= link_to t("admin.actions.hide_author").capitalize, hide_moderation_user_path(comment.user_id, debate_id: @debate.id), method: :put, data: { confirm: t('admin.actions.confirm') } %> <% end %> diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index 0a1fd19a3..1b6f713ba 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -58,10 +58,6 @@ <% end %>  • <%= time_ago_in_words(comment.created_at) %> - - - <%= render 'comments/flag_as_inappropiate_actions', comment: comment %> - <% if comment.as_administrator? %> @@ -81,11 +77,11 @@ <%= render 'comments/votes', comment: comment %> -

+

<%= t("debates.comment.responses", count: comment.children_count) %> <% if user_signed_in? %> -  |  +  |  <%= link_to(comment_link_text(comment), "", class: "js-add-comment-link", data: {'id': dom_id(comment)}) %> @@ -93,7 +89,7 @@ <%= render 'comments/form', {parent: comment, toggeable: true} %> <% end %> -

+
<% end %> diff --git a/app/views/comments/_flag_as_inappropiate_actions.html.erb b/app/views/comments/_flag_as_inappropiate_actions.html.erb index fad83d4d6..9fba8b5b2 100644 --- a/app/views/comments/_flag_as_inappropiate_actions.html.erb +++ b/app/views/comments/_flag_as_inappropiate_actions.html.erb @@ -1,6 +1,23 @@ <% if can? :flag_as_inappropiate, comment %> - <%= link_to t('shared.flag_as_inappropiate'), flag_as_inappropiate_comment_path(comment), method: :put, remote: true %> +  |  + + <% end %> + <% if can? :undo_flag_as_inappropiate, comment %> - <%= link_to t('shared.undo_flag_as_inappropiate'), undo_flag_as_inappropiate_comment_path(comment), method: :put, remote: true %> +  |  + + <% end %> diff --git a/app/views/debates/_flag_as_inappropiate_actions.html.erb b/app/views/debates/_flag_as_inappropiate_actions.html.erb index 8003600e0..6c3d34236 100644 --- a/app/views/debates/_flag_as_inappropiate_actions.html.erb +++ b/app/views/debates/_flag_as_inappropiate_actions.html.erb @@ -1,6 +1,21 @@ <% if can? :flag_as_inappropiate, debate %> - <%= link_to t('shared.flag_as_inappropiate'), flag_as_inappropiate_debate_path(debate), method: :put, remote: true %> + + <% end %> + <% if can? :undo_flag_as_inappropiate, debate %> - <%= link_to t('shared.undo_flag_as_inappropiate'), undo_flag_as_inappropiate_debate_path(debate), method: :put, remote: true %> + + <% end %> diff --git a/app/views/debates/show.html.erb b/app/views/debates/show.html.erb index 8dcc334b8..3b91edc8d 100644 --- a/app/views/debates/show.html.erb +++ b/app/views/debates/show.html.erb @@ -41,8 +41,8 @@  •    <%= link_to t("debates.show.comments", count: @debate.comment_threads.count), "#comments" %> - - +  •  + <%= render 'debates/flag_as_inappropiate_actions', debate: @debate %> diff --git a/app/views/moderation/_menu.html.erb b/app/views/moderation/_menu.html.erb index 41e84287a..f64eeec3a 100644 --- a/app/views/moderation/_menu.html.erb +++ b/app/views/moderation/_menu.html.erb @@ -4,17 +4,17 @@ <%= t("moderation.dashboard.index.title") %> -
  • > +
  • > <%= link_to moderation_debates_path do %> - + <%= t('moderation.menu.flagged_debates') %> <% end %>
  • -
  • > +
  • > <%= link_to moderation_comments_path do %> - - <%= t('moderation.menu.flagged_comments') %> + + <%= t("moderation.menu.flagged_comments") %> <% end %>
  • diff --git a/app/views/moderation/comments/index.html.erb b/app/views/moderation/comments/index.html.erb index 0d89114f1..f4ce8ec67 100644 --- a/app/views/moderation/comments/index.html.erb +++ b/app/views/moderation/comments/index.html.erb @@ -1,45 +1,52 @@ -

    <%= t('moderation.comments.index.title') %>

    +

    <%= t("moderation.comments.index.title") %>

    + +

    <%= page_entries_info @comments %>

    - - - - - + + + + <% @comments.each do |comment| %> - - - - - - <% if can? :mark_as_reviewed, comment %> + + + + <% if can? :archive, comment %> <% end %> - <% if comment.reviewed? %> - <% end %> @@ -47,4 +54,3 @@
    <%= t('moderation.comments.index.headers.flags') %><%= t('moderation.comments.index.headers.updated_at') %><%= t('moderation.comments.index.headers.commentable_type') %><%= t('moderation.comments.index.headers.commentable') %><%= t('moderation.comments.index.headers.comment') %> + <%= t("moderation.comments.index.headers.commentable") %> |  + <%= t("moderation.comments.index.headers.commentable_type") %> |  + <%= t("moderation.comments.index.headers.updated_at") %> + <%= t("moderation.comments.index.headers.comment") %><%= t("moderation.comments.index.headers.flags") %><%= t("moderation.debates.index.headers.actions") %>
    <%= comment.inappropiate_flags_count %><%= l comment.updated_at.to_date %><%= comment.commentable_type.constantize.model_name.human %><%= link_to comment.commentable.title, comment.commentable %><%= comment.body %> - <%= link_to t('moderation.comments.index.hide'), hide_in_moderation_screen_moderation_comment_path(comment, request.query_parameters), method: :put %> + <%= link_to comment.commentable.title, comment.commentable %> +
    + <%= comment.commentable_type.constantize.model_name.human %> + <%= l comment.updated_at.to_date %>
    <%= comment.body %><%= comment.inappropiate_flags_count %> + <%= link_to t("moderation.comments.index.hide"), hide_in_moderation_screen_moderation_comment_path(comment, request.query_parameters), method: :put, class: "delete" %> + - <%= link_to t('moderation.comments.index.mark_as_reviewed'), mark_as_reviewed_moderation_comment_path(comment, request.query_parameters), method: :put %> + <%= link_to t("moderation.comments.index.archive"), archive_moderation_comment_path(comment, request.query_parameters), method: :put, class: "button radius tiny warning" %> - <%= t('moderation.comments.index.reviewed') %> + <% if comment.archived? %> + + <%= t("moderation.comments.index.archived") %>
    <%= paginate @comments %> - diff --git a/app/views/moderation/dashboard/index.html.erb b/app/views/moderation/dashboard/index.html.erb index 16eb4508f..df41493e6 100644 --- a/app/views/moderation/dashboard/index.html.erb +++ b/app/views/moderation/dashboard/index.html.erb @@ -1 +1,5 @@ -

    <%= t("moderation.dashboard.index.title") %>

    +

    <%= t("moderation.dashboard.index.title") %>

    + +

    Lorem ipsum moderator sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

    + +

    Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.

    diff --git a/app/views/moderation/debates/index.html.erb b/app/views/moderation/debates/index.html.erb index 611f68e16..ac11d2159 100644 --- a/app/views/moderation/debates/index.html.erb +++ b/app/views/moderation/debates/index.html.erb @@ -1,43 +1,51 @@ -

    <%= t('moderation.debates.index.title') %>

    +

    <%= t("moderation.debates.index.title") %>

    + +

    <%= page_entries_info @debates %>

    - - - - + + + <% @debates.each do |debate| %> - - - - - <% if can? :mark_as_reviewed, debate %> + + + <% if can? :archive, debate %> <% end %> - <% if debate.reviewed? %> - <% end %> @@ -45,4 +53,3 @@
    <%= t('moderation.debates.index.headers.flags') %><%= t('moderation.debates.index.headers.updated_at') %><%= t('moderation.debates.index.headers.title') %><%= t('moderation.debates.index.headers.description') %> + <%= t("moderation.debates.index.headers.title") %> |  + <%= t("moderation.debates.index.headers.updated_at") %> |  + <%= t("moderation.debates.index.headers.description") %> + <%= t("moderation.debates.index.headers.flags") %><%= t("moderation.debates.index.headers.actions") %>
    <%= debate.inappropiate_flags_count %><%= l debate.updated_at.to_date %><%= link_to debate.title, debate %><%= debate.description %> - <%= link_to t('moderation.debates.index.hide'), hide_in_moderation_screen_moderation_debate_path(debate, request.query_parameters), method: :put %> + <%= link_to debate.title, debate, target: "_blank" %> +
    + <%= l debate.updated_at.to_date %> +
    + <%= debate.description %>
    <%= debate.inappropiate_flags_count %> + <%= link_to t("moderation.debates.index.hide"), hide_in_moderation_screen_moderation_debate_path(debate, request.query_parameters), method: :put, class: "delete" %> + - <%= link_to t('moderation.debates.index.mark_as_reviewed'), mark_as_reviewed_moderation_debate_path(debate, request.query_parameters), method: :put %> + <%= link_to t("moderation.debates.index.archive"), archive_moderation_debate_path(debate, request.query_parameters), method: :put, class: "button radius tiny warning" %> - <%= t('moderation.debates.index.reviewed') %> + <% if debate.archived? %> + + <%= t("moderation.debates.index.archived") %>
    <%= paginate @debates %> - diff --git a/app/views/organizations/registrations/success.html.erb b/app/views/organizations/registrations/success.html.erb new file mode 100644 index 000000000..e246365f5 --- /dev/null +++ b/app/views/organizations/registrations/success.html.erb @@ -0,0 +1,15 @@ +
    +
    +
    +

    <%= t("devise_views.organizations.registrations.success.title") %>

    +

    <%= t("devise_views.organizations.registrations.success.thank_you") %>

    +

    <%= t("devise_views.organizations.registrations.success.instructions_1_html") %>

    +

    <%= t("devise_views.organizations.registrations.success.instructions_2_html") %>

    +

    <%= t("devise_views.organizations.registrations.success.instructions_3_html") %>

    +

    + <%= link_to t("devise_views.organizations.registrations.success.back_to_index"), + root_path, class: "button radius small margin-top" %> +

    +
    +
    +
    diff --git a/app/views/shared/_tags.html.erb b/app/views/shared/_tags.html.erb index 6a61bd4b4..2b599ec77 100644 --- a/app/views/shared/_tags.html.erb +++ b/app/views/shared/_tags.html.erb @@ -10,4 +10,4 @@ <%= link_to "#{debate.tags_count_out_of_limit(limit)}+", debate_path(debate) %> <% end %>
    -<% end %> +<% end %> \ No newline at end of file diff --git a/config/environments/production.rb b/config/environments/production.rb index 7a21a1df4..e84606f73 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -42,7 +42,7 @@ Rails.application.configure do # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. - config.force_ssl = true + # config.force_ssl = true # Use the lowest log level to ensure availability of diagnostic information # when problems arise. diff --git a/config/locales/devise_views.en.yml b/config/locales/devise_views.en.yml index e1b2a571d..f0e1eb33a 100644 --- a/config/locales/devise_views.en.yml +++ b/config/locales/devise_views.en.yml @@ -66,6 +66,13 @@ en: phone_number_label: "Phone number" password_confirmation_label: "Confirm password" submit: "Sign up" + success: + title: "Registration of organization / collective" + thank_you: "Thank you for registering your organization or collective in the website. Now is pending verification." + instructions_1_html: "We will contact you soon in order to verify that you represent your collective." + instructions_2_html: "Meanwhile, review your email. We have sent you a confirmation link to activate your account." + instructions_3_html: "When you confirm your account will then be able to participate as a non-verified organization." + back_to_index: "Ok, go back to index" sessions: new: title: "Log in" diff --git a/config/locales/devise_views.es.yml b/config/locales/devise_views.es.yml index 7ed5298de..49d304748 100644 --- a/config/locales/devise_views.es.yml +++ b/config/locales/devise_views.es.yml @@ -66,6 +66,13 @@ es: phone_number_label: "Teléfono" password_confirmation_label: "Confirmar contraseña" submit: "Registrarse" + success: + title: "Registro de organización / colectivo" + thank_you: "Gracias por registrar tu colectivo en la web. Ahora está pendiente de verificación." + instructions_1_html: "En breve nos pondremos en contacto contigo para verificar que realmente representas a este colectivo." + instructions_2_html: "Mientras revisa tu correo electrónico, te hemos enviado un enlace para confirmar tu cuenta." + instructions_3_html: "Una vez confirmado, podrás empezar a participar como colectivo no verificado." + back_to_index: "Entendido, volver a la página principal" sessions: new: title: "Entrar" diff --git a/config/locales/en.yml b/config/locales/en.yml index e3ebf62d6..322cf585f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -133,8 +133,8 @@ en: shared: tags_cloud: tags: Topics - flag_as_inappropiate: Flag as inappropiate - undo_flag_as_inappropiate: Undo flag as inappropiate + flag_as_inappropiate: Flag as inappropriate + undo_flag_as_inappropiate: Undo flag collective: Collective mailer: comment: diff --git a/config/locales/es.yml b/config/locales/es.yml index 4097c22b9..5c21c039e 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -134,7 +134,7 @@ es: tags_cloud: tags: Temas flag_as_inappropiate: Denunciar como inapropiado - undo_flag_as_inappropiate: Deshacer denunciar como inapropiado + undo_flag_as_inappropiate: Deshacer denuncia collective: Colectivo mailer: comment: diff --git a/config/locales/moderation.en.yml b/config/locales/moderation.en.yml index 2728f10d9..3d61c93a2 100644 --- a/config/locales/moderation.en.yml +++ b/config/locales/moderation.en.yml @@ -8,7 +8,7 @@ en: title: Moderation comments: index: - title: Comments flagged as inappropiate + title: Comments flagged as inappropriate headers: flags: Flags updated_at: Date @@ -16,27 +16,27 @@ en: commentable: Root comment: Comment hide: Hide - mark_as_reviewed: Mark as reviewed - reviewed: Reviewed + archive: Archive + archived: Archived filter: Filter filters: all: All - pending_review: Pending - reviewed: Reviewed + pending: Pending + archived: Archived debates: index: - title: Debates flagged as inappropiate + title: Debates flagged as inappropriate headers: flags: Flags updated_at: Date title: Title description: Description + actions: Actions hide: Hide - mark_as_reviewed: Mark as reviewed - reviewed: Reviewed + archive: Archive + archived: Archived filter: Filter filters: all: All - pending_review: Pending - reviewed: Reviewed - + pending: Pending + archived: Archived diff --git a/config/locales/moderation.es.yml b/config/locales/moderation.es.yml index 2afaec7a9..73886ddb0 100644 --- a/config/locales/moderation.es.yml +++ b/config/locales/moderation.es.yml @@ -8,7 +8,7 @@ es: title: Moderación comments: index: - title: Comentarios Denunciados como Inapropiados + title: Comentarios denunciados como inapropiados headers: flags: Denuncias updated_at: Fecha @@ -16,28 +16,27 @@ es: commentable: Raíz comment: Comentario hide: Ocultar - mark_as_reviewed: Marcar como revisado - reviewed: Revisado + archive: Archivar + archived: Archivado filter: Filtrar filters: all: Todos - pending_review: Pendientes - reviewed: Revisados + pending: Pendientes + archived: Archivados debates: index: - title: Debates Denunciados como Inapropiados + title: Debates denunciados como inapropiados headers: flags: Denuncias updated_at: Fecha title: Título description: Descripción + actions: Acciones hide: Ocultar - mark_as_reviewed: Marcar como revisado - reviewed: Revisado + archive: Archivar + archived: Archivado filter: Filtrar filters: all: Todos - pending_review: Pendientes - reviewed: Revisados - - + pending: Pendientes + archived: Archivados diff --git a/config/routes.rb b/config/routes.rb index a51c75c39..3a75c8634 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -10,6 +10,10 @@ Rails.application.routes.draw do }, skip: [:omniauth_callbacks] + devise_scope :organization do + get "organizations/sign_up/success", to: "organizations/registrations#success" + end + devise_scope :user do get :finish_signup, to: 'users/registrations#finish_signup' patch :do_finish_signup, to: 'users/registrations#do_finish_signup' @@ -84,7 +88,7 @@ Rails.application.routes.draw do member do put :hide put :hide_in_moderation_screen - put :mark_as_reviewed + put :archive end end @@ -92,7 +96,7 @@ Rails.application.routes.draw do member do put :hide put :hide_in_moderation_screen - put :mark_as_reviewed + put :archive end end end diff --git a/db/migrate/20150826112411_rename_reviewed_at_to_archived_at_in_comments_and_debates.rb b/db/migrate/20150826112411_rename_reviewed_at_to_archived_at_in_comments_and_debates.rb new file mode 100644 index 000000000..86bebd8e1 --- /dev/null +++ b/db/migrate/20150826112411_rename_reviewed_at_to_archived_at_in_comments_and_debates.rb @@ -0,0 +1,6 @@ +class RenameReviewedAtToArchivedAtInCommentsAndDebates < ActiveRecord::Migration + def change + rename_column :comments, :reviewed_at, :archived_at + rename_column :debates, :reviewed_at, :archived_at + end +end diff --git a/db/schema.rb b/db/schema.rb index 2fce6ed26..8bb51ae70 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20150825124827) do +ActiveRecord::Schema.define(version: 20150826112411) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -51,7 +51,7 @@ ActiveRecord::Schema.define(version: 20150825124827) do t.datetime "hidden_at" t.datetime "flagged_as_inappropiate_at" t.integer "inappropiate_flags_count", default: 0 - t.datetime "reviewed_at" + t.datetime "archived_at" t.integer "moderator_id" t.integer "administrator_id" t.integer "cached_votes_total", default: 0 @@ -76,10 +76,14 @@ ActiveRecord::Schema.define(version: 20150825124827) do t.datetime "hidden_at" t.datetime "flagged_as_inappropiate_at" t.integer "inappropiate_flags_count", default: 0 +<<<<<<< HEAD t.datetime "reviewed_at" t.integer "cached_votes_total", default: 0 t.integer "cached_votes_up", default: 0 t.integer "cached_votes_down", default: 0 +======= + t.datetime "archived_at" +>>>>>>> master end add_index "debates", ["cached_votes_down"], name: "index_debates_on_cached_votes_down", using: :btree diff --git a/spec/factories.rb b/spec/factories.rb index 0a4922411..ded2e20a0 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -22,8 +22,8 @@ FactoryGirl.define do hidden_at Time.now end - trait :reviewed do - reviewed_at Time.now + trait :archived do + archived_at Time.now end trait :flagged_as_inappropiate do @@ -51,8 +51,8 @@ FactoryGirl.define do hidden_at Time.now end - trait :reviewed do - reviewed_at Time.now + trait :archived do + archived_at Time.now end trait :flagged_as_inappropiate do diff --git a/spec/features/comments_spec.rb b/spec/features/comments_spec.rb index 4ed16d915..58626b02b 100644 --- a/spec/features/comments_spec.rb +++ b/spec/features/comments_spec.rb @@ -133,7 +133,7 @@ feature 'Comments' do expect(page).to have_css(".comment.comment.comment.comment.comment.comment.comment.comment") end - scenario "Flagging as inappropiate", :js do + scenario "Flagging as inappropriate", :js do user = create(:user) debate = create(:debate) comment = create(:comment, commentable: debate) @@ -142,15 +142,16 @@ feature 'Comments' do visit debate_path(debate) within "#comment_#{comment.id}" do - expect(page).to_not have_link "Undo flag as inappropiate" - click_on 'Flag as inappropiate' - expect(page).to have_link "Undo flag as inappropiate" + page.find("#flag-expand-comment-#{comment.id}").click + page.find("#flag-comment-#{comment.id}").click + + expect(page).to have_css("#unflag-expand-comment-#{comment.id}") end expect(InappropiateFlag.flagged?(user, comment)).to be end - scenario "Undoing flagging as inappropiate", :js do + scenario "Undoing flagging as inappropriate", :js do user = create(:user) debate = create(:debate) comment = create(:comment, commentable: debate) @@ -160,9 +161,10 @@ feature 'Comments' do visit debate_path(debate) within "#comment_#{comment.id}" do - expect(page).to_not have_link("Flag as inappropiate", exact: true) - click_on 'Undo flag as inappropiate' - expect(page).to have_link("Flag as inappropiate", exact: true) + page.find("#unflag-expand-comment-#{comment.id}").click + page.find("#unflag-comment-#{comment.id}").click + + expect(page).to have_css("#flag-expand-comment-#{comment.id}") end expect(InappropiateFlag.flagged?(user, comment)).to_not be @@ -286,4 +288,4 @@ feature 'Comments' do end end -end \ No newline at end of file +end diff --git a/spec/features/debates_spec.rb b/spec/features/debates_spec.rb index c685725d8..22b689308 100644 --- a/spec/features/debates_spec.rb +++ b/spec/features/debates_spec.rb @@ -323,9 +323,10 @@ feature 'Debates' do visit debate_path(debate) within "#debate_#{debate.id}" do - expect(page).to_not have_link "Undo flag as inappropiate" - click_on 'Flag as inappropiate' - expect(page).to have_link "Undo flag as inappropiate" + page.find("#flag-expand-debate-#{debate.id}").click + page.find("#flag-debate-#{debate.id}").click + + expect(page).to have_css("#unflag-expand-debate-#{debate.id}") end expect(InappropiateFlag.flagged?(user, debate)).to be @@ -340,9 +341,10 @@ feature 'Debates' do visit debate_path(debate) within "#debate_#{debate.id}" do - expect(page).to_not have_link("Flag as inappropiate", exact: true) - click_on 'Undo flag as inappropiate' - expect(page).to have_link("Flag as inappropiate", exact: true) + page.find("#unflag-expand-debate-#{debate.id}").click + page.find("#unflag-debate-#{debate.id}").click + + expect(page).to have_css("#flag-expand-debate-#{debate.id}") end expect(InappropiateFlag.flagged?(user, debate)).to_not be diff --git a/spec/features/moderation/comments_spec.rb b/spec/features/moderation/comments_spec.rb index 5a4100f77..2e3d1196e 100644 --- a/spec/features/moderation/comments_spec.rb +++ b/spec/features/moderation/comments_spec.rb @@ -104,57 +104,57 @@ feature 'Moderate Comments' do visit moderation_comments_path expect(page).to_not have_link('All') expect(page).to have_link('Pending') - expect(page).to have_link('Reviewed') + expect(page).to have_link('Archived') visit moderation_comments_path(filter: 'all') expect(page).to_not have_link('All') expect(page).to have_link('Pending') - expect(page).to have_link('Reviewed') + expect(page).to have_link('Archived') - visit moderation_comments_path(filter: 'pending_review') + visit moderation_comments_path(filter: 'pending') expect(page).to have_link('All') expect(page).to_not have_link('Pending') - expect(page).to have_link('Reviewed') + expect(page).to have_link('Archived') - visit moderation_comments_path(filter: 'reviewed') + visit moderation_comments_path(filter: 'archived') expect(page).to have_link('All') expect(page).to have_link('Pending') - expect(page).to_not have_link('Reviewed') + expect(page).to_not have_link('Archived') end scenario "Filtering comments" do create(:comment, :flagged_as_inappropiate, body: "Pending comment") create(:comment, :flagged_as_inappropiate, :hidden, body: "Hidden comment") - create(:comment, :flagged_as_inappropiate, :reviewed, body: "Reviewed comment") + create(:comment, :flagged_as_inappropiate, :archived, body: "Archived comment") visit moderation_comments_path(filter: 'all') expect(page).to have_content('Pending comment') expect(page).to_not have_content('Hidden comment') - expect(page).to have_content('Reviewed comment') + expect(page).to have_content('Archived comment') - visit moderation_comments_path(filter: 'pending_review') + visit moderation_comments_path(filter: 'pending') expect(page).to have_content('Pending comment') expect(page).to_not have_content('Hidden comment') - expect(page).to_not have_content('Reviewed comment') + expect(page).to_not have_content('Archived comment') - visit moderation_comments_path(filter: 'reviewed') + visit moderation_comments_path(filter: 'archived') expect(page).to_not have_content('Pending comment') expect(page).to_not have_content('Hidden comment') - expect(page).to have_content('Reviewed comment') + expect(page).to have_content('Archived comment') end scenario "Reviewing links remember the pagination setting and the filter" do per_page = Kaminari.config.default_per_page (per_page + 2).times { create(:comment, :flagged_as_inappropiate) } - visit moderation_comments_path(filter: 'pending_review', page: 2) + visit moderation_comments_path(filter: 'pending', page: 2) - click_link('Mark as reviewed', match: :first) + click_link('Archive', match: :first, exact: true) uri = URI.parse(current_url) query_params = Rack::Utils.parse_nested_query(uri.query).symbolize_keys - expect(query_params[:filter]).to eq('pending_review') + expect(query_params[:filter]).to eq('pending') expect(query_params[:page]).to eq('2') end @@ -172,7 +172,7 @@ feature 'Moderate Comments' do expect(page).to have_content('spammy spam') expect(page).to have_content('1') expect(page).to have_link('Hide') - expect(page).to have_link('Mark as reviewed') + expect(page).to have_link('Archive') end end @@ -187,18 +187,18 @@ feature 'Moderate Comments' do expect(@comment.reload).to be_hidden end - scenario 'Marking the comment as reviewed' do + scenario 'Marking the comment as archived' do within("#comment_#{@comment.id}") do - click_link('Mark as reviewed') + click_link('Archive') end expect(current_path).to eq(moderation_comments_path) within("#comment_#{@comment.id}") do - expect(page).to have_content('Reviewed') + expect(page).to have_content('Archived') end - expect(@comment.reload).to be_reviewed + expect(@comment.reload).to be_archived end end end diff --git a/spec/features/moderation/debates_spec.rb b/spec/features/moderation/debates_spec.rb index 1ea3101e0..b1234bb1b 100644 --- a/spec/features/moderation/debates_spec.rb +++ b/spec/features/moderation/debates_spec.rb @@ -47,57 +47,57 @@ feature 'Moderate debates' do visit moderation_debates_path expect(page).to_not have_link('All') expect(page).to have_link('Pending') - expect(page).to have_link('Reviewed') + expect(page).to have_link('Archived') visit moderation_debates_path(filter: 'all') expect(page).to_not have_link('All') expect(page).to have_link('Pending') - expect(page).to have_link('Reviewed') + expect(page).to have_link('Archived') - visit moderation_debates_path(filter: 'pending_review') + visit moderation_debates_path(filter: 'pending') expect(page).to have_link('All') expect(page).to_not have_link('Pending') - expect(page).to have_link('Reviewed') + expect(page).to have_link('Archived') - visit moderation_debates_path(filter: 'reviewed') + visit moderation_debates_path(filter: 'archived') expect(page).to have_link('All') expect(page).to have_link('Pending') - expect(page).to_not have_link('Reviewed') + expect(page).to_not have_link('Archived') end scenario "Filtering debates" do create(:debate, :flagged_as_inappropiate, title: "Pending debate") create(:debate, :flagged_as_inappropiate, :hidden, title: "Hidden debate") - create(:debate, :flagged_as_inappropiate, :reviewed, title: "Reviewed debate") + create(:debate, :flagged_as_inappropiate, :archived, title: "Archived debate") visit moderation_debates_path(filter: 'all') expect(page).to have_content('Pending debate') expect(page).to_not have_content('Hidden debate') - expect(page).to have_content('Reviewed debate') + expect(page).to have_content('Archived debate') - visit moderation_debates_path(filter: 'pending_review') + visit moderation_debates_path(filter: 'pending') expect(page).to have_content('Pending debate') expect(page).to_not have_content('Hidden debate') - expect(page).to_not have_content('Reviewed debate') + expect(page).to_not have_content('Archived debate') - visit moderation_debates_path(filter: 'reviewed') + visit moderation_debates_path(filter: 'archived') expect(page).to_not have_content('Pending debate') expect(page).to_not have_content('Hidden debate') - expect(page).to have_content('Reviewed debate') + expect(page).to have_content('Archived debate') end scenario "Reviewing links remember the pagination setting and the filter" do per_page = Kaminari.config.default_per_page (per_page + 2).times { create(:debate, :flagged_as_inappropiate) } - visit moderation_debates_path(filter: 'pending_review', page: 2) + visit moderation_debates_path(filter: 'pending', page: 2) - click_link('Mark as reviewed', match: :first) + click_link('Archive', match: :first, exact: true) uri = URI.parse(current_url) query_params = Rack::Utils.parse_nested_query(uri.query).symbolize_keys - expect(query_params[:filter]).to eq('pending_review') + expect(query_params[:filter]).to eq('pending') expect(query_params[:page]).to eq('2') end @@ -114,7 +114,7 @@ feature 'Moderate debates' do expect(page).to have_content('buy buy buy') expect(page).to have_content('1') expect(page).to have_link('Hide') - expect(page).to have_link('Mark as reviewed') + expect(page).to have_link('Archive') end end @@ -129,18 +129,18 @@ feature 'Moderate debates' do expect(@debate.reload).to be_hidden end - scenario 'Marking the debate as reviewed' do + scenario 'Marking the debate as archived' do within("#debate_#{@debate.id}") do - click_link('Mark as reviewed') + click_link('Archive') end expect(current_path).to eq(moderation_debates_path) within("#debate_#{@debate.id}") do - expect(page).to have_content('Reviewed') + expect(page).to have_content('Archived') end - expect(@debate.reload).to be_reviewed + expect(@debate.reload).to be_archived end end end diff --git a/spec/models/ability_spec.rb b/spec/models/ability_spec.rb index ff3e3800c..a7cfd195f 100644 --- a/spec/models/ability_spec.rb +++ b/spec/models/ability_spec.rb @@ -131,8 +131,8 @@ describe Ability do let(:own_debate) { create(:debate, author: user) } let(:hidden_comment) { create(:comment, :hidden) } let(:hidden_debate) { create(:debate, :hidden) } - let(:reviewed_comment) { create(:comment, :reviewed) } - let(:reviewed_debate) { create(:debate, :reviewed) } + let(:archived_comment) { create(:comment, :archived) } + let(:archived_debate) { create(:debate, :archived) } it { should be_able_to(:hide, comment) } it { should be_able_to(:hide_in_moderation_screen, comment) } @@ -144,15 +144,15 @@ describe Ability do it { should_not be_able_to(:hide, hidden_debate) } it { should_not be_able_to(:hide, own_debate) } - it { should be_able_to(:mark_as_reviewed, comment) } - it { should_not be_able_to(:mark_as_reviewed, hidden_comment) } - it { should_not be_able_to(:mark_as_reviewed, reviewed_comment) } - it { should_not be_able_to(:mark_as_reviewed, own_comment) } + it { should be_able_to(:archive, comment) } + it { should_not be_able_to(:archive, hidden_comment) } + it { should_not be_able_to(:archive, archived_comment) } + it { should_not be_able_to(:archive, own_comment) } - it { should be_able_to(:mark_as_reviewed, debate) } - it { should_not be_able_to(:mark_as_reviewed, hidden_debate) } - it { should_not be_able_to(:mark_as_reviewed, reviewed_debate) } - it { should_not be_able_to(:mark_as_reviewed, own_debate) } + it { should be_able_to(:archive, debate) } + it { should_not be_able_to(:archive, hidden_debate) } + it { should_not be_able_to(:archive, archived_debate) } + it { should_not be_able_to(:archive, own_debate) } it { should_not be_able_to(:hide, user) } it { should be_able_to(:hide, other_user) }