Mercurial > hg > soundsoftware-site
changeset 1252:fe3777d42b76 redmine-2.2-integration
Started rewriting the projects#index JS functions.
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Thu, 04 Apr 2013 18:23:05 +0100 |
parents | 9523dff58d3d |
children | 29dd06e01be3 |
files | plugins/redmine_tags/app/views/projects/index.html.erb plugins/redmine_tags/assets/javascripts/projects_index.js |
diffstat | 2 files changed, 57 insertions(+), 49 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/redmine_tags/app/views/projects/index.html.erb Wed Apr 03 16:34:04 2013 +0100 +++ b/plugins/redmine_tags/app/views/projects/index.html.erb Thu Apr 04 18:23:05 2013 +0100 @@ -4,7 +4,6 @@ <% end %> <%= javascript_include_tag 'projects_index', :plugin => 'redmine_tags' %> - <div class="contextual"> <%= link_to l(:label_overall_activity), { :controller => 'activities', :action => 'index' }%> <%= ('| ' + link_to(l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add')).html_safe if User.current.allowed_to?(:add_project, nil, :global => true) %> @@ -16,47 +15,34 @@ </h2> <div style="clear:both;"></div> - <%- form_tag(:controller => :projects, :action => :index, :method => :get, :html => {:id => :project_filtering_form}, :remote => true) do -%> + <%= form_tag(:controller => :projects, :action => :index, :method => :get, :html => {:id => :project_filtering_form}, :remote => true) do -%> - <% if @filter_status=="true" %> - <fieldset id="filters_fieldset" class="collapsible"> - <legend onclick="toggleFieldsetWithState(this);"><%= l(:label_filter_plural) %></legend> - <%- else -%> - <fieldset id="filters_fieldset" class="collapsible collapsed"> - <legend onclick="toggleFieldsetWithState(this);"><%= l(:label_filter_plural) %></legend> - <div style="display: none;"> - <%- end -%> + <fieldset id="filters_fieldset" class="collapsible"> + <legend><%= l(:label_filter_plural) %></legend> - <div> - <div id='filter_tags'> - <%= render :partial => 'filter_search_tags' -%> - </div> + <div> + <div id='filter_tags'> + <%= render :partial => 'filter_search_tags' -%> + </div> - <p class='q'> - <%= label_tag 'q', l('project_filtering_q_label') %> - <%= text_field_tag 'q', @question, :size => 30, :id => 'search-input' %> - </p> + <p class='q'> + <%= label_tag 'q', l('project_filtering_q_label') %> + <%= text_field_tag 'q', @question, :size => 30, :id => 'search-input' %> + </p> - <p style="display: none;"><%= submit_tag( l('button_filter'), :id => 'submitButton') -%></p> - <%= link_to l(:button_apply), {}, :onclick => "$('submitButton').click(); return false;", :class => 'icon icon-checked' -%> - <%= link_to l(:button_clear), {}, :class => 'icon icon-reload' %> - </div> + <p style="display: none;"><%= submit_tag( l('button_filter'), :id => 'submitButton') -%></p> + <%= link_to l(:button_apply), {}, :onclick => "$('submitButton').click(); return false;", :class => 'icon icon-checked' -%> + <%= link_to l(:button_clear), {}, :class => 'icon icon-reload' %> + </div> - <% unless @filter_status=="true" %> - </div> - <%- end -%> + </fieldset> +<%- end -%> -<%- end -%> -</fieldset> - <div id="projects"> <%= render :partial => 'filtered_projects' %> </div> - - - <% other_formats_links do |f| %> <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> <% end %>
--- a/plugins/redmine_tags/assets/javascripts/projects_index.js Wed Apr 03 16:34:04 2013 +0100 +++ b/plugins/redmine_tags/assets/javascripts/projects_index.js Thu Apr 04 18:23:05 2013 +0100 @@ -1,25 +1,44 @@ -function toggleFieldsetWithState(this_field){ - id = Element.up(this_field, 'fieldset').id; +var IndexFilter = { + init: function(){ + var self = this; + $('fieldset#filters_fieldset legend').live("click", self.toggle); + }, - // is the fieldset collapsed? - var status = $(id).hasClassName("collapsed"); - change_session(id, status); + expanded: false, - toggleFieldset(this_field); -} + toggle: function(){ + var fieldset = $(this).parents('fieldset').first(); + fieldset.toggleClass('collapsed'); + fieldset.children('div').toggle(); + } +}; - function submitForm(){ - $('submitButton').click(); - } +/* + function toggleFieldsetWithState(obj){ + var fset = $(obj).parent('fieldset'); -function change_session(id, nstatus) { + // is the fieldset collapsed? + var status = fset.hasClass("collapsed"); + + // change_session(fset, status); + // toggleFieldset(fset); + } + + + function submitForm(){ + $('submitButton').click(); + } + + + function change_session(id, nstatus) { var url = "projects/set_fieldset_status"; - var request = new Ajax.Request(url, { - method: 'post', - parameters: {field_id: id, status: nstatus}, - asynchronous: true - }); -} + var request = new jQuery.ajax(url, { + method: 'post', + parameters: {field_id: id, status: nstatus}, + asynchronous: true + }); + } + function keypressHandler (event){ var key = event.which || event.keyCode; @@ -32,6 +51,9 @@ } } +*/ + $(document).ready(function(){ - $('search-input').on('keypress', keypressHandler); +// $('search-input').on('keypress', keypressHandler); + IndexFilter.init(); }); \ No newline at end of file