Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

amélioration de la gestion des plannings

  • Loading branch information...
commit 2f6b5f23fa5b6df3a1bc3a7d1a253f1953515d2e 1 parent 86b1ea1
Yann PELUD authored
1  app/controllers/plannings_controller.rb
@@ -36,7 +36,6 @@ def create
36 36
37 37
38 38 def update
39   - debugger
40 39 Planning.transaction do
41 40 @planning = Planning.find(params[:id])
42 41 @planning.update_attributes(params[:planning])
12 app/views/menus/_menus.html.erb
@@ -6,9 +6,10 @@
6 6 <%for menu in @menus %>
7 7 <li>
8 8 <div id="mnuMidi_<%=menu.id%>" class="menu_cart <%=menu_position%>">
  9 + <div class="add_cart ui-icon ui-icon-cart right cr_pointer"></div>
9 10 <div class="left">
10   - <div class="checkbox"><input type="checkbox" id="chk_<%=menu.id%>"aria-labelledby=""></div>
11   - <div class="dragicon"><%= image_tag "/images/icones/shopping-bag.gif" %></div>
  11 + <div class="ui-icon ui-icon-grip-dotted-vertical left cr_move"></div>
  12 + <div class="checkbox left"><input type="checkbox" id="chk_<%=menu.id%>"aria-labelledby=""></div>
12 13 </div>
13 14 <div class="link"><%= link_to %Q{#{menu.title}}, :controller => "menus", :action => "show", :id => menu %></div>
14 15 <div class="byline">Posté le <%= l menu.date, :format => :short%> </div>
@@ -23,9 +24,12 @@
23 24 $(document).ready(function() {
24 25 $('.paginationAnchor').html('');
25 26 $('.pagination').appendTo($('.paginationAnchor')) ;
26   -
27 27 $('div[id^=mnuMidi]').dragDropMenus("#cart", '<%= url_for(:action => 'add', :controller => 'choixmenu') %>');
28   -
  28 + $('.add_cart').live('click',function() {
  29 + $.get('<%= url_for(:action => 'add', :controller => 'choixmenu') %>' + '/' + $(this).parent().attr("id"), function(data) {
  30 + $('#cart').html(data);
  31 + });
  32 + });
29 33 });
30 34 </script>
31 35
7 app/views/plannings/_form.html.erb
... ... @@ -1,4 +1,3 @@
1   -<%= form.label :name %><br />
2   -<%= form.text_field :name %><br />
3   -<%= form.label :public %><br />
4   -<%= form.check_box :public %><br />
  1 +<p><%= form.label :name %> <%= form.text_field :name %></p>
  2 +<p><%= form.check_box :public %> <%= form.label :public %></p>
  3 +
9 app/views/plannings/_organise.html.erb
@@ -4,11 +4,12 @@
4 4 <ul id='sortable_<%=jour%>' class='sortable'>
5 5 <% @liste.select{|m| m.day == jour}.each do |plan| %>
6 6 <% menu = Menu.find_by_id(plan.menu_id) %>
7   - <li class='ui-state-default' id='<%= menu.id.to_s %>'>
  7 + <li id='<%= menu.id.to_s %>'>
  8 + <div id="grab_mnu" class="ui-icon ui-icon-grip-dotted-vertical left cr_move"></div>
8 9 <%= menu.title %>
9   - <a href='#' class='delete_mnu icon right'>__</a>
10   - <a href='#' class='up_mnu icon right'>__</a>
11   - <a href='#' class='down_mnu icon right'>__</a>
  10 + <div id='delete_mnu' class='ui-icon ui-icon-trash right cr_pointer'></div>
  11 + <div id='up_mnu' class="ui-icon ui-icon-arrowthick-1-n right cr_pointer"></div>
  12 + <div id='down_mnu' class="ui-icon ui-icon-arrowthick-1-s right cr_pointer"></div>
12 13 </li>
13 14 <% end %>
14 15 </ul>
19 app/views/plannings/show.html.erb
... ... @@ -1,15 +1,12 @@
1 1 <h1>Semaine : <%=@planning.name %></h1>
2   -
3   -<%= render :partial => 'content' %>
4   -
5   -
6   -<div class="post-footer">
7   - <p class="links">
8   - <%= link_to "Appliquer", :controller => "choixmenu", :action => "apply", :id => @planning.id %>
  2 +<div id="sousmenus">
  3 + <%= link_to "Appliquer", {:controller => "choixmenu", :action => "apply", :id => @planning.id}, :class => :button %>
9 4 <% if (current_user && (@planning.user == current_user)) || admin? %>
10   - <%= link_to t("mdls.update"), "#", { :id => 'update-planning'} %>
11   - <%= link_to ("Supprimer", @planning, :confirm => 'Are you sure?', :method => :delete) %>
  5 + <%= link_to t("mdls.update"), "#", { :id => 'update-planning', :class => :button } %>
  6 + <%= link_to ("Supprimer", @planning, :confirm => 'Are you sure?', :method => :delete, :class => :button ) %>
12 7 <% end %>
13   - <%= link_to "Retour", :action => "index" %>
14   - </p>
  8 + <%= link_to "Retour", {:action => "index"}, :class => :button %>
15 9 </div>
  10 +
  11 +<%= render :partial => 'content' %>
  12 +
15 public/javascripts/sortable.js
@@ -29,6 +29,7 @@ $().ready(function() {
29 29 autoOpen: false,
30 30 resizable: false,
31 31 modal: true,
  32 + width: 500,
32 33 buttons: {
33 34 "Valider": function() {
34 35 var form = $("#dialog-form form") ;
@@ -52,25 +53,21 @@ $().ready(function() {
52 53 return false;
53 54 });
54 55
55   - $('.delete_mnu').live('click', function() {
  56 + $('#delete_mnu').live('click', function() {
56 57 $(this).parent().remove();
57 58 return false;
58 59 });
59 60
60   - $('.up_mnu').live('click', function() {
  61 + $('#up_mnu').live('click', function() {
61 62 $(this).parent().appendTo($(this).parents(".organisemenu:first").prev().find('ul'));
62 63 });
63 64
64   - $('.down_mnu').live('click', function() {
  65 + $('#down_mnu').live('click', function() {
65 66 $(this).parent('li:first').appendTo($(this).parents(".organisemenu:first").next().find('ul'));
66 67 });
67 68
68   - $( "#create-planning" ).button().click(function() {
69   - $( "#dialog-form" ).dialog( "open" );
70   - });
71   -
72   - $( "#update-planning" ).button().click(function() {
73   - $( "#dialog-form" ).dialog( "open" );
  69 + $( "#create-planning,#update-planning" ).click(function() {
  70 + $("#dialog-form" ).dialog( "open" );
74 71 });
75 72
76 73 $(".organise").addClass("ui-state-active");
7 public/stylesheets/mdls.css
@@ -84,10 +84,9 @@ body{width:1020px; margin:0px auto;}
84 84 .flash_ajax{ float: left; display: block; width:500px; top: 30px; background-color:#F4D369; padding:4px; bottom: 0; z-index: 1003; border-radius: 4px;}
85 85
86 86
87   -.icon { background-image: url(images/ui-icons_cd0a0a_256x240.png); height: 16px; width: 16px; }
88   -.delete_mnu {background-position: -176px -96px;}
89   -.up_mnu { background-position: 0px -48px;}
90   -.down_mnu { background-position: -64px -48px;}
  87 +.cr_pointer { cursor: pointer;}
  88 +.cr_move { cursor: move;}
  89 +.sortable { min-height: 5px;}
91 90 /*fieldset,img {border:0;}
92 91 address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}
93 92 caption,th{text-align:left;}

0 comments on commit 2f6b5f2

Please sign in to comment.
Something went wrong with that request. Please try again.