diff --git a/Gemfile b/Gemfile index 151e8ab..a067ce1 100644 --- a/Gemfile +++ b/Gemfile @@ -30,25 +30,18 @@ group :doc do # bundle exec rake doc:rails generates the API under doc/api. gem 'sdoc', require: false end - -# Use ActiveModel has_secure_password -# gem 'bcrypt', '~> 3.1.7' - -# Use unicorn as the app server -# gem 'unicorn' - -# Use Capistrano for deployment -# gem 'capistrano', group: :development - -# Use debugger -# gem 'debugger', group: [:development, :test] -# gem 'bootstrap-sass' -# gem 'bootstrap', '~> 4.4.1' gem 'bootstrap-sass' gem 'font-awesome-rails' gem 'popper_js', '~> 1.12.3' -# gem 'dragula-rails' gem 'ffi', '~> 1.9', '>= 1.9.10' gem 'pry', '~> 0.10.3' gem "font-awesome-sass", "~> 6.2.1" - +gem "spring" +gem "spring-commands-rspec" +gem 'ransack' +gem 'kaminari', '~> 0.15.0' +gem 'rubocop-rails', require: false +gem 'paperclip', '~> 3.5' +gem 'remotipart', '~> 1.2' +gem 'friendly_numbers' +gem 'cancancan', '~> 1.17' \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index ce224af..e3238da 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -26,6 +26,7 @@ GEM thread_safe (~> 0.1) tzinfo (~> 0.3.37) arel (4.0.2) + ast (2.4.2) autoprefixer-rails (9.8.6) execjs bcrypt (3.1.18) @@ -33,6 +34,10 @@ GEM autoprefixer-rails (>= 5.2.1) sassc (>= 2.0.0) builder (3.1.4) + cancancan (1.17.0) + climate_control (0.2.0) + cocaine (0.5.8) + climate_control (>= 0.0.3, < 1.0) coderay (1.1.3) coffee-rails (4.0.1) coffee-script (>= 2.2.0) @@ -41,7 +46,7 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.1.10) + concurrent-ruby (1.2.0) devise (3.5.10) bcrypt (~> 3.0) orm_adapter (~> 0.1) @@ -56,22 +61,38 @@ GEM railties (>= 3.2, < 8.0) font-awesome-sass (6.2.1) sassc (~> 2.0) + friendly_numbers (0.6.0) hike (1.2.3) i18n (0.9.5) concurrent-ruby (~> 1.0) + jaro_winkler (1.5.4) jbuilder (1.5.3) activesupport (>= 3.0.0) multi_json (>= 1.2.0) jquery-rails (3.1.5) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) + kaminari (0.15.1) + actionpack (>= 3.0.0) + activesupport (>= 3.0.0) mail (2.7.1) mini_mime (>= 0.1.1) method_source (0.8.2) + mime-types (3.4.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2022.0105) mini_mime (1.1.2) minitest (4.7.5) multi_json (1.15.0) orm_adapter (0.5.0) + paperclip (3.5.4) + activemodel (>= 3.0.0) + activesupport (>= 3.0.0) + cocaine (~> 0.5.3) + mime-types + parallel (1.19.2) + parser (3.2.0.0) + ast (~> 2.4.1) popper_js (1.12.9) pry (0.10.4) coderay (~> 1.1.0) @@ -93,10 +114,31 @@ GEM activesupport (= 4.0.13) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) + rainbow (3.1.1) rake (13.0.6) + ransack (1.8.10) + actionpack (>= 3.0, < 5.2) + activerecord (>= 3.0, < 5.2) + activesupport (>= 3.0, < 5.2) + i18n rdoc (6.2.0) + remotipart (1.4.4) responders (1.1.2) railties (>= 3.2, < 4.2) + rexml (3.2.5) + rubocop (0.81.0) + jaro_winkler (~> 1.5.1) + parallel (~> 1.10) + parser (>= 2.7.0.1) + rainbow (>= 2.2.2, < 4.0) + rexml + ruby-progressbar (~> 1.7) + unicode-display_width (>= 1.4.0, < 2.0) + rubocop-rails (2.5.2) + activesupport + rack (>= 1.1) + rubocop (>= 0.72.0) + ruby-progressbar (1.11.0) sass (3.2.19) sass-rails (4.0.5) railties (>= 4.0.0, < 5.0) @@ -105,9 +147,12 @@ GEM sprockets-rails (~> 2.0) sassc (2.4.0) ffi (~> 1.9) - sdoc (2.5.0) + sdoc (2.6.0) rdoc (>= 5.0) slop (3.6.0) + spring (1.7.2) + spring-commands-rspec (1.0.4) + spring (>= 0.9.1) sprockets (2.12.5) hike (~> 1.2) multi_json (~> 1.0) @@ -127,6 +172,7 @@ GEM tzinfo (0.3.61) uglifier (4.2.0) execjs (>= 0.3.0, < 3) + unicode-display_width (1.8.0) warden (1.2.7) rack (>= 1.0) @@ -136,19 +182,28 @@ PLATFORMS DEPENDENCIES bcrypt bootstrap-sass + cancancan (~> 1.17) coffee-rails (~> 4.0.0) devise ffi (~> 1.9, >= 1.9.10) font-awesome-rails font-awesome-sass (~> 6.2.1) + friendly_numbers jbuilder (~> 1.2) jquery-rails + kaminari (~> 0.15.0) + paperclip (~> 3.5) popper_js (~> 1.12.3) pry (~> 0.10.3) rails (= 4.0.13) + ransack + remotipart (~> 1.2) + rubocop-rails sass-rails (~> 4.0.2) sassc (~> 2.4.0) sdoc + spring + spring-commands-rspec sqlite3 (~> 1.3.13) thor (= 0.19.1) turbolinks diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 39b94b6..cd7bc78 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -13,6 +13,7 @@ //= require jquery //= require jquery_ujs //= require popper +//= require turbolinks //* require tree . //= require custom - +//= require jquery.remotipart diff --git a/app/assets/stylesheets/documents.css.scss b/app/assets/stylesheets/documents.css.scss new file mode 100644 index 0000000..e1989fc --- /dev/null +++ b/app/assets/stylesheets/documents.css.scss @@ -0,0 +1,7 @@ +// Place all the styles related to the documents controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ + +.me-3 { + margin-right: 1.5rem!important; +} \ No newline at end of file diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 2ba523e..f838791 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,6 +1,12 @@ class ApplicationController < ActionController::Base - # Prevent CSRF attacks by raising an exception. - # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception - + before_filter :set_global_search_variable + + def set_global_search_variable + @q = Task.search(params[:q]) + end + rescue_from CanCan::AccessDenied do + flash[:error] = 'Access denied!' + redirect_to root_url + end end diff --git a/app/controllers/board_sections_controller.rb b/app/controllers/board_sections_controller.rb index 355cc0e..173ac56 100644 --- a/app/controllers/board_sections_controller.rb +++ b/app/controllers/board_sections_controller.rb @@ -1,45 +1,52 @@ class BoardSectionsController < ApplicationController - before_action :set_board_section_object, :only=>[:show,:edit,:update,:delete] - before_action :set_board + before_action :set_board_section_object, only: %i[show edit update delete] + before_action :set_board - def index - @board_sections = BoardSection.all - end - def new - @board_section = @board.board_sections.build - end - def show - end - def create - @board_section = @board.board_sections.build(board_section_params) + def index + @board_sections = BoardSection.all + end + + def new + @board_section = @board.board_sections.build + end + + def show; end + + def create + @board_section = @board.board_sections.build(board_section_params) + respond_to do |format| if @board_section.save - redirect_to request.referer + format.js + format.html { redirect_to request.referer } else render :new end end - def edit - end - def update - if @board_section.update(board_section_params) - redirect_to @board_section - else - render :edit - end - end - def delete - @board_section.destroy + end + + def edit; end + + def update + if @board_section.update(board_section_params) redirect_to @board_section + else + render :edit end + end - private - def set_board - @board = Board.find(params[:board_id]) - end - def set_board_section_object - @board_section = BoardSection.find(params[:id]) - end - def board_section_params - params.require(:board_section).permit(:id, :name, :board_type) - end + def delete; end + + private + + def set_board + @board = Board.find(params[:board_id]) + end + + def set_board_section_object + @board_section = BoardSection.find(params[:id]) + end + + def board_section_params + params.require(:board_section).permit(:id, :name, :board_type) + end end diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 15af8e9..a9a3703 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -1,25 +1,32 @@ class BoardsController < ApplicationController - before_action :set_board_object, :only=> [:show,:edit,:update,:destroy] - + before_action :set_board_object, only: %i[show edit update destroy] + def index - @boards = Board.all + @boards = Board.all.page(params[:page]) end + def new - @board = Board.new() + @board = Board.new end + def show @board_sections = @board.board_sections end + def create @board = Board.new(board_params) - if @board.save - redirect_to root_path - else - render :new + respond_to do |format| + if @board.save + format.html { redirect_to root_path } + format.js + else + render :new + end end end - def edit - end + + def edit; end + def update if @board.update(board_params) redirect_to @board @@ -27,17 +34,22 @@ def update render :edit end end + def destroy @board.destroy - redirect_to @board + respond_to do |format| + format.js { render layout: false } + format.html { redirect_to @board } + end end private - def board_params - params.require(:board).permit(:id, :name, :board_type,:board_section_is) - end - def set_board_object - @board = Board.find(params[:id]) - end + def board_params + params.require(:board).permit(:id, :name, :board_type, :board_section_id) + end + + def set_board_object + @board = Board.find(params[:id]) + end end diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 01665c0..2a4f916 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -1,37 +1,35 @@ class CommentsController < ApplicationController - before_action :set_comment_object :only=>[:show,:edit,:update,:delete] + before_action :set_comment_object, only: %i[show edit update delete] -def index - @comments = Comment.all -end -def new - @comment = Comment.new -end -def show: end -def create - @comment = Comment.create(comment_params) - if @comment.save - redirect_to @comment - else - render :new + def index + @comments = Comment.all end -end -def edit: end -def update - if @comment.update(comment_params) - redirect_to @comment - else - render :edit -end -def delete - @comment.delete - redirect_to @comment -end -private + + def new + @comment = @task.comments.build + end + + def show; end + + def create + @comment = Comment.new(comment_params) + respond_to do |format| + if @comment.save + format.html { redirect_to request.referer } + format.js + else + render :new + end + end + end + + private + def set_comment_object @comment = Comment.find(params[:id]) end + def comment_params - params.require(:comment).permit(:id,:description,:task_id,:user_id) + params.require(:comment).permit(:id, :description, :task_id, :user_id) end end diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb new file mode 100644 index 0000000..0675a93 --- /dev/null +++ b/app/controllers/documents_controller.rb @@ -0,0 +1,35 @@ +class DocumentsController < ApplicationController + before_action :set_document_object, only: %i[show edit update delete] + + def index + @documents = Document.all + end + + def new + @document = Document.new + end + + def show; end + + def create + @document = Document.new(document_params) + respond_to do |format| + if @document.save + format.html { redirect_to request.referer } + format.js + else + render :new + end + end + end + + private + + def set_document_object + @document = Document.find(params[:id]) + end + + def document_params + params.require(:document).permit(:file, :task_id) + end +end diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 39848c6..b0a59e9 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -1,4 +1,3 @@ class PagesController < ApplicationController - def index - end + def index; end end diff --git a/app/controllers/sub_tasks_controller.rb b/app/controllers/sub_tasks_controller.rb index 5f67ec9..5002244 100644 --- a/app/controllers/sub_tasks_controller.rb +++ b/app/controllers/sub_tasks_controller.rb @@ -1,41 +1,42 @@ class SubTasksController < ApplicationController - before_action :set_subtask_object, :only=> [:edit,:update,:destroy] + before_action :set_subtask_object, only: %i[edit update destroy] def index @subtasks = SubTask.all end + def new @subtask = SubTask.new end + def create @subtask = SubTask.new(subtask_params) - if - @subtask.save + if @subtask.save redirect_to @subtask else render :new end - end + end - def edit; end - - def update - if @subtask.update(subtask_params) - redirect_to @subtask - else - render :edit - end - end - def delete - @subtask.destroy + def edit; end + + def update + if @subtask.update(subtask_params) redirect_to @subtask + else + render :edit end - private - def subtask_params - params.require(:subtask).permit(:id,:name,:description,:status,:due_date,:task_id) - end - def set_subtask_object - @subtask = SubTask.find(params[:id]) - end + end + + def delete; end + + private + def subtask_params + params.require(:subtask).permit(:id, :name, :description, :status, :due_date, :task_id) + end + + def set_subtask_object + @subtask = SubTask.find(params[:id]) + end end diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 3d0d210..98263e5 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -1,22 +1,42 @@ class TasksController < ApplicationController - before_action :set_task_object, :only=> [:edit,:update,:destroy] + load_and_authorize_resource + before_action :set_task, only: %i[show edit update destroy] - def index + def index + @board = Board.find(params[:q][:board]) + @q = Task.ransack(params[:q]) + respond_to do |format| + @board_sections = BoardSection.where(id: @q.result.pluck(:board_section_id)) + format.js + end end + def new @task = Task.new end + + def show + @documents = Document.all + respond_to do |format| + format.js + format.html + end + end + def create - @task = Task.new(task_params) - if - @task.save - redirect_to request.referer - else - render :new + @task = Task.new(task_params) + respond_to do |format| + if @task.save + format.html { redirect_to request.referer } + format.js + else + render :new + end end end - def edit - end + + def edit; end + def update if @task.update(task_params) redirect_to @task @@ -24,16 +44,23 @@ def update render :edit end end - def delete + + def destroy + authorize! :destroy, @task @task.destroy - redirect_to @task + respond_to do |format| + format.js + format.html + end end - + private - def task_params - params.require(:task).permit(:id,:name,:description,:status,:due_date,:story_point,:board_id,:board_section_id) - end - def set_task_object - @task = Task.find(params[:id]) - end + + def task_params + params.require(:task).permit(:id, :name, :description, :status, :due_date, :story_point, :board_id, :board_section_id,:user_id, user_ids: []) + end + + def set_task + @task = Task.find(params[:id]) + end end diff --git a/app/helpers/documents_helper.rb b/app/helpers/documents_helper.rb new file mode 100644 index 0000000..242b4fc --- /dev/null +++ b/app/helpers/documents_helper.rb @@ -0,0 +1,2 @@ +module DocumentsHelper +end diff --git a/app/helpers/tasks_helper.rb b/app/helpers/tasks_helper.rb index ce894d0..1d35c11 100644 --- a/app/helpers/tasks_helper.rb +++ b/app/helpers/tasks_helper.rb @@ -1,2 +1,5 @@ module TasksHelper + def extract_name_from_email(user) + user.email.split('@').first + end end diff --git a/app/models/ability.rb b/app/models/ability.rb new file mode 100644 index 0000000..d4f348b --- /dev/null +++ b/app/models/ability.rb @@ -0,0 +1,12 @@ +class Ability + include CanCan::Ability + def initialize(user) + if user.present? + can :read, Task + can :create, Task + can :destroy, Task, user_id: user.id + else + can :search, Task + end + end +end \ No newline at end of file diff --git a/app/models/assigned_task.rb b/app/models/assigned_task.rb index 4394dc9..b560edb 100644 --- a/app/models/assigned_task.rb +++ b/app/models/assigned_task.rb @@ -1,4 +1,4 @@ class AssignedTask < ActiveRecord::Base - belongs_to :users - belongs_to :tasks + belongs_to :user + belongs_to :task end diff --git a/app/models/board.rb b/app/models/board.rb index 0bbe70b..88c09fc 100644 --- a/app/models/board.rb +++ b/app/models/board.rb @@ -1,5 +1,6 @@ class Board < ActiveRecord::Base - belongs_to :user - has_many :board_sections - has_many :tasks + paginates_per 3 + belongs_to :user + has_many :board_sections + has_many :tasks end diff --git a/app/models/board_section.rb b/app/models/board_section.rb index e724f6b..c0345f1 100644 --- a/app/models/board_section.rb +++ b/app/models/board_section.rb @@ -1,4 +1,4 @@ class BoardSection < ActiveRecord::Base - belongs_to :board - has_many :tasks + belongs_to :board + has_many :tasks end diff --git a/app/models/comment.rb b/app/models/comment.rb index 6bcd691..29eb3df 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -1,4 +1,4 @@ class Comment < ActiveRecord::Base - belongs_to :user - belongs_to :task + belongs_to :user + belongs_to :task end diff --git a/app/models/document.rb b/app/models/document.rb new file mode 100644 index 0000000..b9109f8 --- /dev/null +++ b/app/models/document.rb @@ -0,0 +1,5 @@ +class Document < ActiveRecord::Base + belongs_to :task + has_attached_file :file + validates_attachment_content_type :file, content_type: %w(text/plain application/text.txt application/zip application/msword application/vnd.ms-office application/vnd.ms-excel application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) +end diff --git a/app/models/sub_task.rb b/app/models/sub_task.rb index 0f8f663..7faf554 100644 --- a/app/models/sub_task.rb +++ b/app/models/sub_task.rb @@ -1,3 +1,3 @@ class SubTask < ActiveRecord::Base - belongs_to :task + belongs_to :task end diff --git a/app/models/task.rb b/app/models/task.rb index f68e4a8..d0e85dd 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -1,8 +1,10 @@ class Task < ActiveRecord::Base - belongs_to :user - belongs_to :board - belongs_to :board_section - has_many :assigned_tasks - has_many :sub_tasks - has_many :comments + belongs_to :user + belongs_to :board + belongs_to :board_section + has_many :assigned_tasks + has_many :users, through: :assigned_tasks + has_many :sub_tasks + has_many :comments + has_many :documents end diff --git a/app/models/user.rb b/app/models/user.rb index 8bc6455..3be037d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,9 +2,9 @@ class User < ActiveRecord::Base # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable has_many :boards - has_many :tasks has_many :assigned_tasks + has_many :tasks, through: :assigned_tasks has_many :comments devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable -end +end \ No newline at end of file diff --git a/app/views/board_sections/create.js.erb b/app/views/board_sections/create.js.erb new file mode 100644 index 0000000..e3f627c --- /dev/null +++ b/app/views/board_sections/create.js.erb @@ -0,0 +1,3 @@ +$('#add-new-section-modal').modal('toggle'); +$('.board-sections-area').html("<%= escape_javascript render(:partial => 'boards/results', :locals => { board_sections: @board.board_sections, board: @board }) %>"); +$('#board-section-title').val(''); \ No newline at end of file diff --git a/app/views/boards/_board_section.html.erb b/app/views/boards/_board_section.html.erb new file mode 100644 index 0000000..e854aeb --- /dev/null +++ b/app/views/boards/_board_section.html.erb @@ -0,0 +1,8 @@ +
+
<%= board_section.name%>
+
+ <% board_section&.tasks&.each do |task|%> + <%= render :partial => 'boards/task', locals: {task: task} %> + <%end%> +
+
\ No newline at end of file diff --git a/app/views/boards/_boards.html.erb b/app/views/boards/_boards.html.erb new file mode 100644 index 0000000..7cfac4d --- /dev/null +++ b/app/views/boards/_boards.html.erb @@ -0,0 +1,19 @@ + + + <%= link_to board.name, board_path(board) %> + + + <%= board.board_type%> + + + <%= board.created_at%> + + + <%= link_to edit_board_path(board) do %> + + <% end %> + <%= link_to board_path(board), method: :delete, remote: true, data: { confirm: 'Are you sure?' } do %> + + <% end %> + + diff --git a/app/views/boards/_comment.html.erb b/app/views/boards/_comment.html.erb new file mode 100644 index 0000000..99f4f7b --- /dev/null +++ b/app/views/boards/_comment.html.erb @@ -0,0 +1,7 @@ +
+<%= image_tag "avatar-3.jpg", class:"me-3 avatar-sm rounded-circle", alt:"Generic placeholder image"%> +
+
User Name
+<%= comment.description%> +
+
\ No newline at end of file diff --git a/app/views/boards/_document.html.erb b/app/views/boards/_document.html.erb new file mode 100644 index 0000000..f492998 --- /dev/null +++ b/app/views/boards/_document.html.erb @@ -0,0 +1,24 @@ +
+
+
+
+
+
+ + <%= document.file_content_type.split('/')[0]%> + +
+
+
+ <%= document&.file_file_name%> +

<%= FriendlyNumbers.number_to_human_size(document.file_file_size) %>

+
+
+ + + +
+
+
+
+
diff --git a/app/views/boards/_results.html.erb b/app/views/boards/_results.html.erb new file mode 100644 index 0000000..fee7476 --- /dev/null +++ b/app/views/boards/_results.html.erb @@ -0,0 +1,3 @@ +<% board_sections&.each do |board_section |%> + <%= render :partial => 'boards/board_section', locals: {board_section: board_section, board: board} %> +<% end%> diff --git a/app/views/boards/_search-results.js.erb b/app/views/boards/_search-results.js.erb new file mode 100644 index 0000000..f956266 --- /dev/null +++ b/app/views/boards/_search-results.js.erb @@ -0,0 +1,2 @@ +$('#blogpost-table').hide(); +$('#search-results').html("<%= escape_javascript(render :partial => 'boards/results') %>"); \ No newline at end of file diff --git a/app/views/boards/_task.html.erb b/app/views/boards/_task.html.erb new file mode 100644 index 0000000..53ac96b --- /dev/null +++ b/app/views/boards/_task.html.erb @@ -0,0 +1,29 @@ +
+
+ <%= task.due_date.strftime("%d-%b-%Y")%> <%= task.due_date.strftime("%I:%M%p")%> + <%= task.status%> +
+ <%= link_to task.name, task_path(task), remote: true %> +
+

+ <%= image_tag "avatar-2.jpg", class:"avatar-xs rounded-circle me-1", alt:"user-img"%> + Robert Carlile +


+

+ + <%= task.comments.count()%> Comments + +

+ +
+ <%= link_to task_path(task), method: :delete, remote: true, data: { confirm: 'Are you sure?' } do %> + + <% end %> +
+
+
+ \ No newline at end of file diff --git a/app/views/boards/_task_modal.html.erb b/app/views/boards/_task_modal.html.erb new file mode 100644 index 0000000..7dd6c24 --- /dev/null +++ b/app/views/boards/_task_modal.html.erb @@ -0,0 +1,82 @@ + \ No newline at end of file diff --git a/app/views/boards/create.js.erb b/app/views/boards/create.js.erb new file mode 100644 index 0000000..67207db --- /dev/null +++ b/app/views/boards/create.js.erb @@ -0,0 +1,2 @@ +$('#add-new-task-modal').modal('toggle'); +$(".board-add").append("<%= escape_javascript render(:partial => 'boards/boards', :locals => {board: @board}) %>"); \ No newline at end of file diff --git a/app/views/boards/destroy.js.erb b/app/views/boards/destroy.js.erb new file mode 100644 index 0000000..1444f2f --- /dev/null +++ b/app/views/boards/destroy.js.erb @@ -0,0 +1,2 @@ +var element = document.getElementById('board<%= @board.id%>') +element.remove(); \ No newline at end of file diff --git a/app/views/boards/edit.html.erb b/app/views/boards/edit.html.erb index 9568ba6..72a8901 100644 --- a/app/views/boards/edit.html.erb +++ b/app/views/boards/edit.html.erb @@ -1,28 +1,24 @@ - - - + <%= f.submit class:'btn btn-primary'%> + <% end %> + \ No newline at end of file diff --git a/app/views/boards/index.html.erb b/app/views/boards/index.html.erb index b0cdb9f..c380de0 100644 --- a/app/views/boards/index.html.erb +++ b/app/views/boards/index.html.erb @@ -1,73 +1,43 @@ - -
- -
-
-
-
- -
-

Kanban Board - Add New

+
+
+
+
+
+

Kanban Board

+ Add New
-
- - - - - - - - - - - - - - <% @boards.each do |b|%> - - - - - - - <%end%> - -
Board NameBoard TypeBoard Created Date Actions
- <%= link_to b.name, board_path(b) %> - - <%= b.board_type%> - - <%= b.created_at%> - - <%= link_to edit_board_path(b) do %> - - <% end %> - <%= link_to board_path(b), method: :delete, data: { confirm: 'Are you sure?' } do %> - - <% end %> -
- +
+
+ + + + + + + + + + +
<%= paginate @boards %>
+ <% @boards.each do |board|%> + <%= render :partial => 'boards/boards', locals: {board: board} %> + + <%end%> + +
Board NameBoard TypeBoard Created Date Actions
+
<%= paginate @boards %>
- - - - - - - - - +
- +
Settings
@@ -76,36 +46,34 @@ - -
Color Scheme
-
-
- - -
-
- - -
- -
Width
-
-
- - -
-
- - -
- - Purchase Now -
+
Color Scheme
+
+
+ + +
+
+ + +
+
Width
+
+
+ + +
+
+ + +
+ + Purchase Now +
-
- +
+
+ <%= form_for Board.new, remote: true do |f|%> +
+
+ + <%= f.text_field :name, class:'form-control form-control-light', id:'task-title', placeholder:'Enter title' %> +
+
+
+
+ + <%= f.text_area :board_type, class:'form-control form-control-light', id:'description', placeholder:'Enter Description' %> +
+
+ + <%= f.submit class:'btn btn-primary'%> + <% end %> + diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index 1c17bd8..f704aca 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -1,137 +1,116 @@
- -
+
-
-
- -
-

<%= @board.name%> - Add New Section - Add New Task -

+
+
+ +
+

<%= @board.name%> + Add New Section + Add New Task +

+
+
+
+
+
+
+
+
+ <%= render :partial => "boards/results", :locals => {board_sections: @board_sections, board: @board} %> +
+
-
- -
-
-
- <% @board_sections.each do |board_section|%> -
"> -
<%= board_section.name%>
-
- - <% board_section.tasks&.each do |task|%> -
-
- <%= task.due_date%> - <%= task.status%> -
- <%= task.name%> -
-

- - Description:<%= task.description%> - -

- -
+
+
-
- - - - \ No newline at end of file + +
\ No newline at end of file diff --git a/app/views/comments/create.js.erb b/app/views/comments/create.js.erb new file mode 100644 index 0000000..1959256 --- /dev/null +++ b/app/views/comments/create.js.erb @@ -0,0 +1,2 @@ +$('#comment-add').append("<%= escape_javascript render(:partial => 'boards/comment', :locals => {comment: @comment}) %>"); +$('#comment-body').val(''); \ No newline at end of file diff --git a/app/views/documents/create.js.erb b/app/views/documents/create.js.erb new file mode 100644 index 0000000..f139a44 --- /dev/null +++ b/app/views/documents/create.js.erb @@ -0,0 +1,2 @@ +$('#file_upload').append("<%= escape_javascript render(:partial => 'boards/document', :locals => {document: @document}) %>"); +$('#no-name').val(''); \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 358a063..2c859b6 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,29 +1,29 @@ - - TaskManager - <%= stylesheet_link_tag "application", media: "all", "data-turbo-track" => "reload" %> - <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> - <%= csrf_meta_tags %> - - -
-
-
- <%= render 'shared/app/header' %> - <%= yield %> -

<%= notice %>

-

<%= alert %>

+ + TaskManager + <%= stylesheet_link_tag "application", media: "all", "data-turbo-track" => "reload" %> + <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> + <%= csrf_meta_tags %> + <%= javascript_include_tag :defaults %> + + +
+
+
+ <%= render 'shared/app/header' %> + <%= yield %> +

<%= notice %>

+

<%= alert %>

+
+ <%= render 'shared/app/footer' %> +
- <%= render 'shared/app/footer' %> -
-
- - - - - - - - + + + + + + + diff --git a/app/views/shared/app/_footer.html.erb b/app/views/shared/app/_footer.html.erb index 61c5791..b4bc7d0 100644 --- a/app/views/shared/app/_footer.html.erb +++ b/app/views/shared/app/_footer.html.erb @@ -1,16 +1,16 @@
-
-
-
- © Hyper - Coderthemes.com -
-
- -
-
-
-
\ No newline at end of file +
+
+
+ © Hyper - Coderthemes.com +
+
+ +
+
+
+ \ No newline at end of file diff --git a/app/views/shared/app/_header.html.erb b/app/views/shared/app/_header.html.erb index 749dd03..347c8a4 100644 --- a/app/views/shared/app/_header.html.erb +++ b/app/views/shared/app/_header.html.erb @@ -1,601 +1,536 @@ \ No newline at end of file diff --git a/app/views/tasks/create.js.erb b/app/views/tasks/create.js.erb new file mode 100644 index 0000000..f1f31fb --- /dev/null +++ b/app/views/tasks/create.js.erb @@ -0,0 +1,6 @@ +$('#add-new-task-modal').modal('toggle'); +$('#task-list-<%=params[:task][:board_section_id]%>').append("<%= escape_javascript render(:partial => 'boards/task', :locals => {task: @task}) %>"); +$('#task-title').val(''); +$('#description').val(''); +$('#due_date').val(''); +$('#story_point').val(''); \ No newline at end of file diff --git a/app/views/tasks/destroy.js.erb b/app/views/tasks/destroy.js.erb new file mode 100644 index 0000000..73d4240 --- /dev/null +++ b/app/views/tasks/destroy.js.erb @@ -0,0 +1,2 @@ +var element = document.getElementById('task<%= @task.id%>') +element.remove(); diff --git a/app/views/tasks/index.js.erb b/app/views/tasks/index.js.erb new file mode 100644 index 0000000..322521e --- /dev/null +++ b/app/views/tasks/index.js.erb @@ -0,0 +1,2 @@ +$("#blogpost-table").hide(); +$("#search-results").html("<%= escape_javascript(render :partial => 'boards/results', locals: {board_sections: @board_sections, board: @board}) %>"); \ No newline at end of file diff --git a/app/views/tasks/show.js.erb b/app/views/tasks/show.js.erb new file mode 100644 index 0000000..1aa8bcc --- /dev/null +++ b/app/views/tasks/show.js.erb @@ -0,0 +1,4 @@ +$('#myModal').html('<%= escape_javascript(render :partial => 'boards/task_modal', :locals => {task: @task}) %>'); +$('#task-detail-modal').modal('show') +$('#task-detail-modal').remove() +$('#task-detail-modal').modal().hide(); \ No newline at end of file diff --git a/config/environments/production.rb b/config/environments/production.rb index 8eaaf11..cc39c6b 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -77,5 +77,4 @@ # config.autoflush_log = false # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new end diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index 72aca7e..1d970fd 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -3,3 +3,4 @@ # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register_alias "text/html", :iphone +Mime::Type.register "text/plain", :text, [], %w(txt) \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 7a7bc2c..87ded9a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,59 +7,5 @@ resources :board_sections resources :tasks resources :comments - - # The priority is based upon order of creation: first created -> highest priority. - # See how all your routes lay out with "rake routes". - - # You can have the root of your site routed with "root" - # root 'welcome#index' - - # Example of regular route: - # get 'products/:id' => 'catalog#view' - - # Example of named route that can be invoked with purchase_url(id: product.id) - # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase - - # Example resource route (maps HTTP verbs to controller actions automatically): - # resources :products - - # Example resource route with options: - # resources :products do - # member do - # get 'short' - # post 'toggle' - # end - # - # collection do - # get 'sold' - # end - # end - - # Example resource route with sub-resources: - # resources :products do - # resources :comments, :sales - # resource :seller - # end - - # Example resource route with more complex sub-resources: - # resources :products do - # resources :comments - # resources :sales do - # get 'recent', on: :collection - # end - # end - - # Example resource route with concerns: - # concern :toggleable do - # post 'toggle' - # end - # resources :posts, concerns: :toggleable - # resources :photos, concerns: :toggleable - - # Example resource route within a namespace: - # namespace :admin do - # # Directs /admin/products/* to Admin::ProductsController - # # (app/controllers/admin/products_controller.rb) - # resources :products - # end + resources :documents end diff --git a/db/migrate/20221222063741_create_task.rb b/db/migrate/20221222063741_create_task.rb index 5d8c535..dd373ab 100644 --- a/db/migrate/20221222063741_create_task.rb +++ b/db/migrate/20221222063741_create_task.rb @@ -9,6 +9,7 @@ def change t.references :board, index: true t.references :board_section, index: true t.references :user, index: true + t.timestamps end end end diff --git a/db/migrate/20230119125311_add_timestamps_to_task.rb b/db/migrate/20230119125311_add_timestamps_to_task.rb new file mode 100644 index 0000000..ebe45fc --- /dev/null +++ b/db/migrate/20230119125311_add_timestamps_to_task.rb @@ -0,0 +1,6 @@ +class AddTimestampsToTask < ActiveRecord::Migration + def change + add_column :tasks, :created_at, :datetime + add_column :tasks, :updated_at, :datetime + end +end diff --git a/db/migrate/20230125081611_create_documents.rb b/db/migrate/20230125081611_create_documents.rb new file mode 100644 index 0000000..7baef38 --- /dev/null +++ b/db/migrate/20230125081611_create_documents.rb @@ -0,0 +1,9 @@ +class CreateDocuments < ActiveRecord::Migration + def change + create_table :documents do |t| + t.attachment :file + t.timestamps + t.references :task + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 095488d..b96d0ba 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: 20221230141334) do +ActiveRecord::Schema.define(version: 20230119125311) do create_table "assigned_tasks", force: true do |t| t.integer "user_id" @@ -32,12 +32,10 @@ t.string "name" t.string "board_type" t.integer "user_id" - t.integer "board_section_id" t.datetime "created_at" t.datetime "updated_at" end - add_index "boards", ["board_section_id"], name: "index_boards_on_board_section_id" add_index "boards", ["user_id"], name: "index_boards_on_user_id" create_table "comments", force: true do |t| @@ -68,6 +66,8 @@ t.integer "board_id" t.integer "board_section_id" t.integer "user_id" + t.datetime "created_at" + t.datetime "updated_at" end add_index "tasks", ["board_id"], name: "index_tasks_on_board_id" diff --git a/public/javascripts/jquery.iframe-transport.js b/public/javascripts/jquery.iframe-transport.js new file mode 100644 index 0000000..2b5bdb5 --- /dev/null +++ b/public/javascripts/jquery.iframe-transport.js @@ -0,0 +1,249 @@ +// This [jQuery](https://jquery.com/) plugin implements an `"); + + // The first load event gets fired after the iframe has been injected + // into the DOM, and is used to prepare the actual submission. + iframe.one("load", function() { + + // The second load event gets fired when the response to the form + // submission is received. The implementation detects whether the + // actual payload is embedded in a `