This commit is contained in:
Nicolas Bally 2019-06-02 16:21:57 +02:00
parent ab6d2b7d95
commit 473b7f8ed4
9 changed files with 156 additions and 77 deletions

View File

@ -1061,4 +1061,54 @@ h1{
background-image: none;
}
.big_icon{
font-size:2em;
display:inline-block;
margin-right:10px;
text-decoration:none;
color:rgba(0,0,0,0.2);
&.active{
color:#ffd400;
}
}
.done{
color:green;
}
.fire{
color:red;
}
.undone, .unfire{
color:rgba(0,0,0,0.2);
}
.i_task_row{
margin:10px 0;
padding:0px 0;
.icon{
background:transparent !important;
}
.qi_pannel.padding{
padding:10px;
}
td{
border:0 !important;
border:0 !important;
vertical-align: middle !important;
}
table{
margin:0;
}
}

View File

@ -43,20 +43,40 @@ class Admin::ITasksController < ApplicationController
def create
@i_task = ITask.new(params.require(:i_task).permit!)
if @i_task.save
if @i_task.name? and (tasks = @i_task.name.split(";")).size > 1
tasks.each do |task|
t = @i_task.dup
t.name = task.lstrip
t.save
end
if @i_task.i_website
@i_website = @i_task
@new_i_task = @i_task.i_website.i_tasks.new
@i_tasks = @i_task.i_website.i_tasks.order("end_at ASC").all
else
@i_tasks = ITask.order("end_at ASC").all
end
else
if @i_task.save
if @i_task.i_website
@new_i_task = @i_task.i_website.i_tasks.new
@i_tasks = @i_task.i_website.i_tasks.order("end_at ASC").all
else
@i_tasks = ITask.order("end_at ASC").all
end
else
render action: "new"
else
render action: "new"
end
end
end

View File

@ -14,7 +14,7 @@
.qi_row
#i_task_form
-@i_tasks = ITask.all
-@i_tasks = ITask.where(:i_previ_id => 1, :done => false).all
=render :partial => "admin/i_tasks/form", :locals => {:new_var => true}

View File

@ -1,77 +1,64 @@
.qi_row.i_task_row#i_task{:id => i_task.id}
.qi_pannel.qi_plain.padding
.qi_pannel.qi_plain.padding{:style => ("background:linear-gradient(to bottom, white 50%,rgba(242, 38, 19, 0.2) 80%,rgba(242, 38, 19, 0.7) 100%);" if (!i_task.done and i_task.end_at and i_task.end_at < Date.today) and !params[:no_detail])}
%table.table
%tr
%td{:style => "width:20px;"}
%td{:style => (params[:no_detail] ? "width:50px;" : "width:230px;")}
-if i_task.done
=link_to admin_i_task_path(:id => i_task.id, :i_task => {:done => false}), :remote => true, :method => :put do
.done
.big_icon.done
=ic :check
-else
=link_to admin_i_task_path(:id => i_task.id, :i_task => {:done => true}), :remote => true, :method => :put do
.undone
.big_icon.undone
=ic :check
-if !params[:no_detail]
-if i_task.urgent
=link_to admin_i_task_path(:id => i_task.id, :i_task => {:urgent => false}), :remote => true, :method => :put do
.big_icon.fire{:style => ("color:green" if i_task.done) }
=ic :"free-code-camp"
-else
=link_to admin_i_task_path(:id => i_task.id, :i_task => {:urgent => true}), :remote => true, :method => :put do
.big_icon.unfire
=ic :"free-code-camp"
-[[1, :star],[2, :"arrow-right"],[3, :history]].each do |number|
-if i_task.i_previ_id == number[0]
=link_to admin_i_task_path(:id => i_task.id, :i_task => {:i_previ_id => nil}), :remote => true, :method => :put do
.big_icon.active
=ic number[1]
-else
=link_to admin_i_task_path(:id => i_task.id, :i_task => {:i_previ_id => number[0]}), :remote => true, :method => :put do
.big_icon
=ic number[1]
%td= i_task.name
%td.project{:style => "width:200px;"}
= i_task.i_website.name if i_task.i_website
%br
= i_task.p_customer.show_name if i_task.p_customer
%td.time{:style => "width:100px;"}
-if i_task.minutes
= i_task.minutes
min
-if !@i_website
%td.project{:style => "width:200px;"}
= i_task.i_website.name if i_task.i_website
%br
= i_task.p_customer.show_name if i_task.p_customer
-if !params[:no_detail]
%td.time{:style => "width:100px;"}
-if i_task.minutes
= i_task.minutes
min
%td.actions{:style => "width:120px;"}
= link_to i(:"trash-o"), [:admin, i_task], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cette tache ? ' } , :remote => true
= link_to i(:pencil), edit_admin_i_task_path(i_task), :remote => true
= link_to i(:eye), admin_i_task_path(i_task)
%td.actions{:style => "width:120px;"}
= link_to i(:"trash-o"), [:admin, i_task], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cette tache ? ' } , :remote => true
= link_to i(:pencil), edit_admin_i_task_path(i_task), :remote => true
= link_to i(:eye), admin_i_task_path(i_task)
:scss
.project,.time,.actions{
display:none;
}
.done,.undone{
font-size:2em;
}
.done{
color:green;
}
.undone{
color:rgba(0,0,0,0.2);
}
.i_task_row{
margin:10px 0;
padding:0px 0;
.qi_pannel.padding{
padding:10px;
}
td{
border:0 !important;
border:0 !important;
vertical-align: middle !important;
}
table{
margin:0;
}
}

View File

@ -14,11 +14,12 @@
=render @i_tasks.where(:end_at => ech.end_at).order("end_at ASC, done DESC")
-we = @i_tasks.where(:end_at => nil).order("end_at ASC, done DESC")
-if we.count > 0
%p{:style => "margin-top:20px;"}
%strong Sans échéances
%p{:style => "margin-top:20px;"}
%strong Sans échéances
=render @i_tasks.where(:end_at => nil).order("end_at ASC, done DESC")
=render we
%br
%br

View File

@ -10,6 +10,7 @@
.qi_row
.qi_pannel.qi_plain.padding#i_task_form
=link_to "Masquer les détails", "?no_detail=true"
=render :partial => "admin/i_tasks/form", :locals => {:new_var => true}

View File

@ -20,7 +20,11 @@
%body.admin
#right_bar
.element
=link_to "/" do
.cat#big_cat_clients
=ic :"home"
.element
=link_to admin_p_customers_path do
.cat#big_cat_clients

View File

@ -0,0 +1,10 @@
class AddSomeStuffToITasks < ActiveRecord::Migration
def change
add_column :i_tasks, :done_at, :date
add_column :i_tasks, :urgent, :boolean, :default => false
add_column :i_tasks, :i_previ_id, :integer
add_column :i_tasks, :i_task_type_id, :integer
add_column :i_tasks, :from_customer, :boolean, :default => false
add_column :i_tasks, :i_task_bill_state_id, :integer
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20190520102905) do
ActiveRecord::Schema.define(version: 20190602113239) do
create_table "admin_admin_roles", force: :cascade do |t|
t.integer "admin_id", limit: 4
@ -432,16 +432,22 @@ ActiveRecord::Schema.define(version: 20190520102905) do
end
create_table "i_tasks", force: :cascade do |t|
t.integer "i_website_id", limit: 4
t.string "name", limit: 255
t.text "descritpion", limit: 65535
t.integer "i_website_id", limit: 4
t.string "name", limit: 255
t.text "descritpion", limit: 65535
t.date "end_at"
t.integer "image_file_id", limit: 4
t.boolean "done", default: false
t.integer "minutes", limit: 4
t.integer "admin_id", limit: 4
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "image_file_id", limit: 4
t.boolean "done", default: false
t.integer "minutes", limit: 4
t.integer "admin_id", limit: 4
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.date "done_at"
t.boolean "urgent", default: false
t.integer "i_previ_id", limit: 4
t.integer "i_task_type_id", limit: 4
t.boolean "from_customer", default: false
t.integer "i_task_bill_state_id", limit: 4
end
add_index "i_tasks", ["admin_id"], name: "index_i_tasks_on_admin_id", using: :btree