From 473b7f8ed45793deac845c5f8c8074de5614fdea Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Sun, 2 Jun 2019 16:21:57 +0200 Subject: [PATCH] suite --- app/assets/stylesheets/admin.css.scss | 50 +++++++++ app/controllers/admin/i_tasks_controller.rb | 28 ++++- app/views/admin/admin_auths/index.haml | 2 +- app/views/admin/i_tasks/_i_task.html.haml | 101 ++++++++---------- app/views/admin/i_tasks/_results.html.haml | 9 +- app/views/admin/i_websites/show.html.haml | 1 + app/views/layouts/admin.html.haml | 6 +- ...0190602113239_add_some_stuff_to_i_tasks.rb | 10 ++ db/schema.rb | 26 +++-- 9 files changed, 156 insertions(+), 77 deletions(-) create mode 100644 db/migrate/20190602113239_add_some_stuff_to_i_tasks.rb diff --git a/app/assets/stylesheets/admin.css.scss b/app/assets/stylesheets/admin.css.scss index 8b9eb46..c37caf5 100644 --- a/app/assets/stylesheets/admin.css.scss +++ b/app/assets/stylesheets/admin.css.scss @@ -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; + } + +} + + diff --git a/app/controllers/admin/i_tasks_controller.rb b/app/controllers/admin/i_tasks_controller.rb index ea7f80f..efa4f49 100644 --- a/app/controllers/admin/i_tasks_controller.rb +++ b/app/controllers/admin/i_tasks_controller.rb @@ -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 diff --git a/app/views/admin/admin_auths/index.haml b/app/views/admin/admin_auths/index.haml index 91ac567..bc97360 100644 --- a/app/views/admin/admin_auths/index.haml +++ b/app/views/admin/admin_auths/index.haml @@ -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} diff --git a/app/views/admin/i_tasks/_i_task.html.haml b/app/views/admin/i_tasks/_i_task.html.haml index 75e7dab..4f99aa6 100644 --- a/app/views/admin/i_tasks/_i_task.html.haml +++ b/app/views/admin/i_tasks/_i_task.html.haml @@ -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; - } - - } - - - \ No newline at end of file diff --git a/app/views/admin/i_tasks/_results.html.haml b/app/views/admin/i_tasks/_results.html.haml index 2895439..619b7e9 100644 --- a/app/views/admin/i_tasks/_results.html.haml +++ b/app/views/admin/i_tasks/_results.html.haml @@ -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 diff --git a/app/views/admin/i_websites/show.html.haml b/app/views/admin/i_websites/show.html.haml index 9e8a735..341171b 100644 --- a/app/views/admin/i_websites/show.html.haml +++ b/app/views/admin/i_websites/show.html.haml @@ -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} diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml index c7ddd1c..4472c63 100644 --- a/app/views/layouts/admin.html.haml +++ b/app/views/layouts/admin.html.haml @@ -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 diff --git a/db/migrate/20190602113239_add_some_stuff_to_i_tasks.rb b/db/migrate/20190602113239_add_some_stuff_to_i_tasks.rb new file mode 100644 index 0000000..5dd9acb --- /dev/null +++ b/db/migrate/20190602113239_add_some_stuff_to_i_tasks.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 2c10f24..3420114 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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