Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/apiofboardsboardsectionstasks #6

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
793e1b3
feat: forms board sections tasks and boards with ajax
owaisali01 Jan 12, 2023
b942931
add pagination for boards
owaisali01 Jan 12, 2023
63cd626
fix/identations
owaisali01 Jan 17, 2023
8b25753
fix identation
owaisali01 Jan 17, 2023
1c2f25c
fix double qouts to single
owaisali01 Jan 17, 2023
44853eb
fix optimize code with rubocop
owaisali01 Jan 17, 2023
be88510
feature/see task details in popup after click on a card
owaisali01 Jan 20, 2023
3671200
feature/add comment and delete tasks with ajax
owaisali01 Jan 24, 2023
e0b2838
feature/ delete task -comment on a task - upload file on a task
owaisali01 Jan 27, 2023
e108e2f
fix/upload file and helper
owaisali01 Jan 27, 2023
2388c4a
feature/create task assignees and show
owaisali01 Jan 30, 2023
195b223
feature/User should not be able to delete any other users tasks
owaisali01 Feb 1, 2023
86d17cc
fix/identation of html files
owaisali01 Feb 2, 2023
2126326
create api for boards boards sections tasks and assign tasks
owaisali01 Feb 28, 2023
9094379
api of boards boardsections tasks assign task with nested routes
owaisali01 Feb 28, 2023
21dd085
fix identation of api controllers
owaisali01 Mar 1, 2023
4f26391
delete unnecessary files of javascript and stylesheets
owaisali01 Mar 1, 2023
19eda7a
fix identations
owaisali01 Mar 1, 2023
5a03aef
remove unnecessary files of api/v1 from views and helpers
owaisali01 Mar 1, 2023
6a19d2b
fix all issues thats comments on github
owaisali01 Mar 2, 2023
52434f7
delete pages controler and all other files related to pages controller
owaisali01 Mar 2, 2023
d54ea51
fix api messages
owaisali01 Mar 2, 2023
aafae3e
fix api before_actions
owaisali01 Mar 2, 2023
1a2195f
fix identations
owaisali01 Mar 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 11 additions & 16 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,20 @@ 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'
gem 'rack-cors'
gem 'active_model_serializers', '~> 0.10.0'
66 changes: 64 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ GEM
erubis (~> 2.7.0)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
active_model_serializers (0.10.0)
actionpack (>= 4.0)
activemodel (>= 4.0)
railties (>= 4.0)
activemodel (4.0.13)
activesupport (= 4.0.13)
builder (~> 3.1.0)
Expand All @@ -26,13 +30,18 @@ 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)
bootstrap-sass (3.4.1)
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)
Expand All @@ -41,7 +50,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)
Expand All @@ -56,28 +65,45 @@ 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)
method_source (~> 0.8.1)
slop (~> 3.4)
rack (1.5.5)
rack-cors (1.0.3)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.0.13)
Expand All @@ -93,10 +119,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)
Expand All @@ -105,9 +152,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)
Expand All @@ -127,28 +177,40 @@ 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)

PLATFORMS
ruby

DEPENDENCIES
active_model_serializers (~> 0.10.0)
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)
rack-cors
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
Expand Down
3 changes: 2 additions & 1 deletion app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
//= require jquery
//= require jquery_ujs
//= require popper
//= require turbolinks
//* require tree .
//= require custom

//= require jquery.remotipart
3 changes: 3 additions & 0 deletions app/assets/javascripts/documents.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
7 changes: 7 additions & 0 deletions app/assets/stylesheets/documents.css.scss
Original file line number Diff line number Diff line change
@@ -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;
}
2 changes: 2 additions & 0 deletions app/controllers/api/v1/application_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class Api::V1::ApplicationController < ActionController::API
end
61 changes: 61 additions & 0 deletions app/controllers/api/v1/board_sections_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# frozen_string_literal: true

module Api
module V1
class BoardSectionsController < ActionController::Base
before_action :set_board_section_object, only: %i[show edit update delete]
before_action :set_board_object, only: %i[create update]

def index
@boardsections = BoardSection.all
render json: @boardsections
end

def show
render json: @boardsection, status: 200
end

def create
@boardsection = @board.board_sections.new(board_section_params)
if @boardsection.save
render json: @boardsection, status: 200
else
render status: :bad_request, errors: @boardsection.errors.full_messages
end
end

def update
if @boardsection.update(board_section_params)
render json: @boardsection, status: 200
else
render status: :bad_request, errors: @boardsection.errors.full_messages
end
end

def destroy
@boardsection = BoardSection.find(params[:id])
if @boardsection.destroy
render json: {message: "board section successfully deleted"}, status: 200
else
render status: :bad_request, errors: @boardsection.errors.full_messages
end
end

private

def set_board_section_object
@boardsection = BoardSection.find_by(id: params[:id])
render json: {message: "Board section not found"}, status: :unprocessable_entity unless @boardsection.present?
end

def set_board_object
@board = Board.find_by(id: board_section_params[:board_id])
render json: {message: "Board not found"}, status: :unprocessable_entity unless @board.present?
end

def board_section_params
params.require(:board_section).permit(:id, :name, :board_id)
end
end
end
end
60 changes: 60 additions & 0 deletions app/controllers/api/v1/boards_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# frozen_string_literal: true

module Api
module V1
class BoardsController < ActionController::Base
before_action :set_board_object, only: %i[show update destroy]
before_action :set_user_object, only: %i[create update]

def index
@boards = Board.all
render json: @boards
end

def show
render json: @board, status: 200
end

def create
@board = @user.boards.new(board_params)
if @board.save
render json: @board, status: 200
else
render status: :unprocessable_entity, errors: @board.errors.full_messages
end
end

def update
if @board.update(board_params)
render json: @board, status: 200
else
render status: :unprocessable_entity, errors: @board.errors.full_messages
end
end

def destroy
if @board.destroy
render json: {message: "board successfully deleted"}, status: 200
else
render status: :unprocessable_entity, errors: @board.errors.full_messages
end
end

private

def set_board_object
@board = Board.find_by(id: params[:id])
render json: {message: "Board not found"}, status: :unprocessable_entity unless @board.present?
end

def set_user_object
@user = User.find_by(id: board_params[:user_id])
render json: {message: "user not found"}, status: :unprocessable_entity unless @user.present?
end

def board_params
params.require(:board).permit(:id, :name, :board_type, :user_id)
end
end
end
end
Loading