This commit is contained in:
Nicolas Bally 2019-07-22 17:26:39 +02:00
parent 473b7f8ed4
commit d52b227880
9 changed files with 157 additions and 39 deletions

View File

@ -973,6 +973,7 @@ h1{
bottom:0; bottom:0;
width:100px; width:100px;
padding:10px 0; padding:10px 0;
z-index:10;
box-shadow:0 0 5px rgba(0,0,0,0.2); box-shadow:0 0 5px rgba(0,0,0,0.2);
.bottom{ .bottom{
position:absolute; position:absolute;
@ -1065,9 +1066,9 @@ h1{
.big_icon{ .big_icon{
font-size:2em; font-size:1.5em;
display:inline-block; display:inline-block;
margin-right:10px; margin-right:3px;
text-decoration:none; text-decoration:none;
color:rgba(0,0,0,0.2); color:rgba(0,0,0,0.2);
@ -1094,7 +1095,7 @@ h1{
background:transparent !important; background:transparent !important;
} }
.qi_pannel.padding{ .qi_pannel.padding{
padding:10px; padding:2px;
} }

View File

@ -26,6 +26,12 @@ class Admin < ActiveRecord::Base
before_create { generate_token(:remember_token) } before_create { generate_token(:remember_token) }
def show_name
self.firstname.to_s + " " + self.name.to_s
end
def send_password_reset def send_password_reset
generate_token(:reset_password_token) generate_token(:reset_password_token)
self.reset_password_sent_at = Time.now self.reset_password_sent_at = Time.now

View File

@ -6,4 +6,14 @@ class ITask < ActiveRecord::Base
validates :name, :presence => true validates :name, :presence => true
before_validation do
if !self.done
self.done_at = nil
elsif self.done and !self.done_at?
self.done_at = Time.now
end
end
end end

View File

@ -1,24 +1,66 @@
-@new_i_task = @new_i_task || ITask.new(:i_website_id => (@i_website.id if @i_website)) -@new_i_task = @new_i_task || ITask.new(:admin_id => current_admin.id, :i_website_id => (@i_website.id if @i_website), :end_at => (Date.today + 2.day))
-new_var = new_var || false -new_var = new_var || false
.task_form_wrapper
=semantic_form_for [:admin, (new_var ? @new_i_task : @i_task)], :remote => true do |f| =semantic_form_for [:admin, (new_var ? @new_i_task : @i_task)], :remote => true do |f|
.content .content.task_form
=f.inputs do %table{:style => "width:100%;"}
= f.input :i_website_id, :label => "Site :", :collection => IWebsite.all, :as => :select, :include_blank => true =f.inputs do
= f.input :name, :label => "Libélé :" %tr
= f.input :minutes, :label => "Temps estimé :" %td{:style => "width:120px;"}= f.input :admin_id, :label => false, :collection => Admin.all, :as => :select, :include_blank => true, :member_label => :show_name
= f.input :end_at, :label => "Echeance", :as => :date %td{:style => "width:200px;"}= f.input :i_website_id, :label => false, :placeholder => "Projet :", :collection => IWebsite.all, :as => :select, :include_blank => true
= f.input :done, :label => "Accomplis ?" %td= f.input :name, :label => false, :placeholder => "Libélé"
=# f.input :status, :label => "Nom :" %td{:style => "width:100px;"}= f.input :minutes, :label => false, :placeholder => "Temps estimé (min)" , :as => :string
-if f.object.id
%td{:style => "width:100px;"}= f.input :minutes_done, :label => false, :placeholder => "Temps passé (min)" , :as => :string
%td{:style => "width:120px;"}= f.input :end_at, :label => false, :placeholder => "Echéance", :as => :date
%td{:style => "width:20px;"}=f.submit "OK !", :class => "btn btn-primary"
:scss
#qi_pane_hover{
table, tr, td, tbody{
display:block !important;
width:auto !important;
}
td{
padding-bottom:10px !important;
}
}
#new_i_task_form{
.task_form_wrapper{
position:fixed;
bottom:0;
left:100px;
right:0;
background:white;
padding:10px 20px;
box-shadow:0 0 5px rgba(0,0,0,0.5);
z-index:1;
}
}
.task_form{
input{
margin:0;
}
td{
padding:0;
}
.form-group{
padding:0;
margin:0;
}
}
.actions=f.submit "sauvegarder", :class => "btn btn-primary"

View File

@ -3,7 +3,7 @@
%table.table %table.table
%tr %tr
%td{:style => (params[:no_detail] ? "width:50px;" : "width:230px;")} %td{:style => (params[:no_detail] ? "width:30px;" : "width:150px;")}
-if i_task.done -if i_task.done
=link_to admin_i_task_path(:id => i_task.id, :i_task => {:done => false}), :remote => true, :method => :put do =link_to admin_i_task_path(:id => i_task.id, :i_task => {:done => false}), :remote => true, :method => :put do
.big_icon.done .big_icon.done
@ -39,10 +39,10 @@
%td{:style => "width:150px;"}= i_task.admin.show_name if i_task.admin
%td= i_task.name %td= i_task.name
-if !@i_website -if !@i_website
%td.project{:style => "width:200px;"} %td.project{:style => "width:150px;"}
= i_task.i_website.name if i_task.i_website = i_task.i_website.name if i_task.i_website
%br %br
= i_task.p_customer.show_name if i_task.p_customer = i_task.p_customer.show_name if i_task.p_customer

View File

@ -1,24 +1,72 @@
.qi_header .qi_header
.right= link_to 'Ajouter un projet', new_admin_i_task_path(), :class => "btn btn-primary", :remote => true %h1 To do
%h1
Sites & projets
.qi_row .qi_row
.qi_pannel.qi_plain.padding
%table.table -if params[:i_previ_id]
%tr -@i_tasks = ITask.where(:i_previ_id => params[:i_previ_id], :done => false).all
%th Client
-elsif params[:archive]
-@i_tasks = ITask.where(:done => true).all
-elsif params[:urgent]
-@i_tasks = ITask.where(:urgent => true, :done => false).all
-elsif params[:no]
-@i_tasks = ITask.where(:done => false, :i_previ_id => nil).all
-else
-params[:all] = true
-@i_tasks = ITask.where(:done => false).all
.tasks_menu
=link_to admin_i_tasks_path(:no => 1), :class => ("active" if params[:no]) do
Non planifiées
=link_to admin_i_tasks_path(:all => 1), :class => ("active" if params[:all]) do
Toutes les tâches
=link_to admin_i_tasks_path(:urgent => 1), :class => ("active" if params[:urgent]) do
=ic :"free-code-camp"
Urgent
=link_to admin_i_tasks_path(:i_previ_id => 1), :class => ("active" if params[:i_previ_id].to_s == "1") do
=ic :star
Aujourd'hui
=link_to admin_i_tasks_path(:i_previ_id => 2), :class => ("active" if params[:i_previ_id].to_s == "2") do
=ic :"arrow-right"
Rapidement
=link_to admin_i_tasks_path(:i_previ_id => 3), :class => ("active" if params[:i_previ_id].to_s == "3") do
=ic :history
Un jour
=link_to admin_i_tasks_path(:archive => 1), :class => ("active" if params[:archive]) do
Journal
:scss
.tasks_menu{
a{
display:inline-block;
padding:4px 8px;
&:hover,&.active{
font-weight:bold;
}
}
}
#i_task_form
#new_i_task_form=render :partial => "admin/i_tasks/form", :locals => {:new_var => true}
%th Nom .row
%th Url provisoire #i_tasks_results= render :partial => "admin/i_tasks/results"
%th Url
%th Status
%th
%tbody#i_tasks_rows
=render @i_tasks

View File

@ -1,2 +1,7 @@
$('#i_tasks_results').html("<%= escape_javascript(render(:partial => "admin/i_tasks/results"))%>"); $('#i_task_<%= @i_task.id %>').replaceWith("<%= escape_javascript(render(@i_task))%>");
<% if false %>
//$('#i_tasks_results').html("<%= escape_javascript(render(:partial => "admin/i_tasks/results"))%>");
<% end %>
close_pane_hover(); close_pane_hover();

View File

@ -0,0 +1,5 @@
class AddMinutesDoneToITasks < ActiveRecord::Migration
def change
add_column :i_tasks, :minutes_done, :integer
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20190602113239) do ActiveRecord::Schema.define(version: 20190722151424) do
create_table "admin_admin_roles", force: :cascade do |t| create_table "admin_admin_roles", force: :cascade do |t|
t.integer "admin_id", limit: 4 t.integer "admin_id", limit: 4
@ -448,6 +448,7 @@ ActiveRecord::Schema.define(version: 20190602113239) do
t.integer "i_task_type_id", limit: 4 t.integer "i_task_type_id", limit: 4
t.boolean "from_customer", default: false t.boolean "from_customer", default: false
t.integer "i_task_bill_state_id", limit: 4 t.integer "i_task_bill_state_id", limit: 4
t.integer "minutes_done", limit: 4
end end
add_index "i_tasks", ["admin_id"], name: "index_i_tasks_on_admin_id", using: :btree add_index "i_tasks", ["admin_id"], name: "index_i_tasks_on_admin_id", using: :btree