diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e8460f5e86..c5da0b443b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -63,8 +63,6 @@ class ApplicationController < ActionController::Base before_filter :user_setup, :check_if_login_required, :set_localization filter_parameter_logging :password - before_filter :check_for_first_login, :if => :check_if_login_required - rescue_from ActionController::InvalidAuthenticityToken, :with => :invalid_authenticity_token @@ -283,12 +281,7 @@ class ApplicationController < ActionController::Base end def redirect_back_or_default(default) - redirect_to default if (redirect_back == false) - false - end - - def redirect_back - back_url = CGI.unescape(params[:back_url].to_s) + back_url = URI.escape(CGI.unescape(params[:back_url].to_s)) if !back_url.blank? begin uri = URI.parse(back_url) @@ -298,9 +291,10 @@ class ApplicationController < ActionController::Base return end rescue URI::InvalidURIError - # don't do anything + # redirect to default end end + redirect_to default false end @@ -491,25 +485,6 @@ class ApplicationController < ActionController::Base render options end - def check_for_first_login - user = User.current - return true if (!user.first_login or !user.logged?) - user.first_login = false - user.save - if request.get? - url = url_for(params) - else - url = url_for(:controller => params[:controller], :action => params[:action], :id => params[:id], :project_id => params[:project_id]) - end - respond_to do |format| - format.html { redirect_to :controller => "users", :action => "set_impaired_flag", :id => User.current, :back_url => url } - format.atom { redirect_to :controller => "users", :action => "set_impaired_flag", :id => User.current, :back_url => url } - format.xml { head :unauthorized } - format.json { head :unauthorized } - end - false - end - # Overrides #default_template so that the api template # is used automatically if it exists def default_template(action_name = self.action_name) diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index eddd652b06..5181478e3f 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -53,7 +53,6 @@ class MyController < ApplicationController @user.safe_attributes = params[:user] @user.pref.attributes = params[:pref] @user.pref[:no_self_notified] = (params[:no_self_notified] == '1') - @user.pref[:impaired] = !!(params[:pref].try(:[], :impaired)) if @user.save @user.pref.save @user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : []) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 66c417daa6..84dff43375 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -144,7 +144,6 @@ class UsersController < ApplicationController was_activated = (@user.status_change == [User::STATUS_REGISTERED, User::STATUS_ACTIVE]) # TODO: Similar to My#account @user.pref.attributes = params[:pref] - @user.pref[:impaired] = !!(params[:pref].try(:[], :impaired)) @user.pref[:no_self_notified] = (params[:no_self_notified] == '1') if @user.save @@ -212,19 +211,6 @@ class UsersController < ApplicationController end end - def set_impaired_flag - user = User.current - user.first_login = false - if request.get? - user.save - @back_url = url_for(params[:back_url]) - elsif request.post? || request.put? - user.impaired = !!(params[:pref].try(:[], :impaired)) - user.save - redirect_back - end - end - private def find_user diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4a3db19fd0..94f68acf85 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -250,13 +250,11 @@ module ApplicationHelper def render_project_jump_box(projects = [], html_options = {}) projects ||= User.current.memberships.collect(&:project).compact.uniq if projects.any? - impaired = User.current.impaired? - option_tags = impaired ? (content_tag :option, l(:label_jump_to_a_project), :value => "") : (content_tag :option, "", :value => "") - option_tags << project_tree_options_for_select(projects, :selected => @project) do |p| - { :value => url_for(:controller => 'projects', :action => 'show', :id => p, :jump => current_menu_item) } - end - html_options[:class] ||= "" - html_options[:class] << " chzn-select " if !impaired + # option_tags = content_tag :option, l(:label_jump_to_a_project), :value => "" + option_tags = (content_tag :option, "", :value => "" ) + option_tags << project_tree_options_for_select(projects, :selected => @project) do |p| + { :value => url_for(:controller => 'projects', :action => 'show', :id => p, :jump => current_menu_item) } + end select_tag "", option_tags, html_options.merge({ :onchange => "if (this.value != \'\') { window.location = this.value; }" }) end end diff --git a/app/models/user.rb b/app/models/user.rb index 43955c7897..7ccaeb4669 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -250,20 +250,6 @@ class User < Principal @time_zone ||= (self.pref.time_zone.blank? ? nil : ActiveSupport::TimeZone[self.pref.time_zone]) end - def impaired? - !!impaired - end - - def impaired=(value) - @impaired = (self.pref[:impaired] = !!value) - self.pref.save - @impaired - end - - def impaired - @impaired ||= (self.pref[:impaired].nil? ? self.pref[:impaired] = false : self.pref[:impaired]) - end - def wants_comments_in_reverse_order? self.pref[:comments_sorting] == 'desc' end diff --git a/app/views/layouts/base.rhtml b/app/views/layouts/base.rhtml index 33ebb99bd9..aba88b03b0 100644 --- a/app/views/layouts/base.rhtml +++ b/app/views/layouts/base.rhtml @@ -53,7 +53,7 @@ <%= link_to l(:label_project_plural), :controller => 'projects', :action => 'index' %> <% end %> diff --git a/app/views/my/account.rhtml b/app/views/my/account.rhtml index 151f94d3a9..77c5c22487 100644 --- a/app/views/my/account.rhtml +++ b/app/views/my/account.rhtml @@ -34,11 +34,6 @@ <%= render :partial => 'users/mail_notifications' %> -

<%=l(:text_impaired_information)%>

-
-<%= render :partial => 'users/impaired_flag_checkbox' %> -
-

<%=l(:label_preferences)%>

<%= render :partial => 'users/preferences' %> diff --git a/app/views/users/_form.rhtml b/app/views/users/_form.rhtml index d250b32e2d..e55f8c2344 100644 --- a/app/views/users/_form.rhtml +++ b/app/views/users/_form.rhtml @@ -19,10 +19,6 @@ <%= call_hook(:view_users_form, :user => @user, :form => f) %>
-
- <%= render :partial => "users/set_impaired_flag" %> -
-

<%=l(:label_authentication)%>

<% unless @auth_sources.empty? %> diff --git a/app/views/users/_impaired_flag_checkbox.rhtml b/app/views/users/_impaired_flag_checkbox.rhtml deleted file mode 100644 index 74bdd74baf..0000000000 --- a/app/views/users/_impaired_flag_checkbox.rhtml +++ /dev/null @@ -1,4 +0,0 @@ -

- <%= label_tag :'pref[impaired]', l(:label_impaired_checkbox) %> - <%= check_box_tag :'pref[impaired]', true, User.current.impaired? ? true : false %> -

diff --git a/app/views/users/_impaired_flag_description.rhtml b/app/views/users/_impaired_flag_description.rhtml deleted file mode 100644 index 0a949a3fe5..0000000000 --- a/app/views/users/_impaired_flag_description.rhtml +++ /dev/null @@ -1,3 +0,0 @@ -

- <%= l(:text_impaired_information) %> -

\ No newline at end of file diff --git a/app/views/users/_set_impaired_flag.rhtml b/app/views/users/_set_impaired_flag.rhtml deleted file mode 100644 index 6a831b72be..0000000000 --- a/app/views/users/_set_impaired_flag.rhtml +++ /dev/null @@ -1,2 +0,0 @@ -<%= render :partial => "users/impaired_flag_description" %> -<%= render :partial => "users/impaired_flag_checkbox" %> diff --git a/app/views/users/set_impaired_flag.rhtml b/app/views/users/set_impaired_flag.rhtml deleted file mode 100644 index 05eb00e730..0000000000 --- a/app/views/users/set_impaired_flag.rhtml +++ /dev/null @@ -1,7 +0,0 @@ -<% form_tag({ :controller => 'users', :action => "set_impaired_flag", :id => User.current, :back_url => @back_url }, {:method => :put}) do %> - <%= render :partial => "users/impaired_flag_description" %> -
- <%= render :partial => "users/impaired_flag_checkbox"%> -
- <%= submit_tag l(:button_save) %> -<% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 1ac1a1fb84..56c7053c5e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -998,7 +998,3 @@ en: description_compare_to: Compare to version description_active: Active? description_current_position: "You are here:" - - text_impaired_information: "Chiliproject offers a slightly different User Interface for visually/motorically impaired Users" - label_impaired_checkbox: "Check to use adjusted Chiliproject Interface" - label_impaired_settings: Impairment Settings diff --git a/config/routes.rb b/config/routes.rb index b594415e75..7d55aa99b7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -126,7 +126,6 @@ ActionController::Routing::Routes.draw do |map| map.with_options :controller => 'users' do |users| users.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil, :conditions => {:method => :get} - users.connect 'users/:id/set_impaired_flag', :action => 'set_impaired_flag' users.with_options :conditions => {:method => :post} do |user_actions| user_actions.connect 'users/:id/memberships', :action => 'edit_membership' diff --git a/db/migrate/20111114124552_add_user_first_logged_in_and_impaired_fields.rb b/db/migrate/20111114124552_add_user_first_logged_in_and_impaired_fields.rb deleted file mode 100644 index a04ed2ba85..0000000000 --- a/db/migrate/20111114124552_add_user_first_logged_in_and_impaired_fields.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AddUserFirstLoggedInAndImpairedFields < ActiveRecord::Migration - def self.up - add_column :users, :first_login, :boolean, :null => false, :default => true - add_column :user_preferences, :impaired, :boolean, :default => false - end - - def self.down - remove_column :users, :first_login - remove_column :user_preferences, :impaired - end -end diff --git a/test/exemplars/user_exemplar.rb b/test/exemplars/user_exemplar.rb index 368a281e71..c28f3e3c92 100644 --- a/test/exemplars/user_exemplar.rb +++ b/test/exemplars/user_exemplar.rb @@ -41,8 +41,4 @@ class User < Principal @last_lastname.succ! @last_lastname end - - def self.first_login - false - end end diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml index 95a598bd50..bcd1369351 100644 --- a/test/fixtures/users.yml +++ b/test/fixtures/users.yml @@ -17,7 +17,6 @@ users_004: mail_notification: all login: rhill type: User - first_login: false users_001: created_on: 2006-07-19 19:12:21 +02:00 status: 1 @@ -36,7 +35,6 @@ users_001: mail_notification: all login: admin type: User - first_login: false users_002: created_on: 2006-07-19 19:32:09 +02:00 status: 1 @@ -55,7 +53,6 @@ users_002: mail_notification: all login: jsmith type: User - first_login: false users_003: created_on: 2006-07-19 19:33:19 +02:00 status: 1 @@ -74,7 +71,6 @@ users_003: mail_notification: all login: dlopper type: User - first_login: false users_005: id: 5 created_on: 2006-07-19 19:33:19 +02:00 @@ -92,7 +88,6 @@ users_005: mail_notification: all login: dlopper2 type: User - first_login: false users_006: id: 6 created_on: 2006-07-19 19:33:19 +02:00 @@ -109,7 +104,6 @@ users_006: mail_notification: only_my_events login: '' type: AnonymousUser - first_login: false users_007: id: 7 created_on: 2006-07-19 19:33:19 +02:00 @@ -126,7 +120,6 @@ users_007: mail_notification: only_my_events login: someone type: User - first_login: false users_008: id: 8 created_on: 2006-07-19 19:33:19 +02:00 @@ -143,7 +136,6 @@ users_008: mail_notification: only_my_events login: miscuser8 type: User - first_login: false users_009: id: 9 created_on: 2006-07-19 19:33:19 +02:00 @@ -160,7 +152,6 @@ users_009: mail_notification: only_my_events login: miscuser9 type: User - first_login: false groups_010: id: 10 lastname: A Team