-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from nickel/ui
Improvement on UI
- Loading branch information
Showing
36 changed files
with
704 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
app/packages/accounts/views/accounts/shared/_links.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# frozen_string_literal: true | ||
|
||
class PictosController < ApplicationController | ||
before_action :authenticate_account! | ||
|
||
def index | ||
@pictos = Picto::FindAll | ||
.call( | ||
keyword: params[:q], | ||
enabled: !params[:only_disabled].present?, | ||
page: params[:page] | ||
).value! | ||
end | ||
|
||
def enable | ||
Picto::Enable | ||
.call(picto_id: params[:id]) | ||
|
||
redirect_to pictos_path(q: params[:q], only_disabled: params[:only_disabled]) | ||
end | ||
|
||
def disable | ||
Picto::Disable | ||
.call(picto_id: params[:id]) | ||
|
||
redirect_to pictos_path(q: params[:q], only_disabled: params[:only_disabled]) | ||
end | ||
end |
95 changes: 95 additions & 0 deletions
95
app/packages/planning/controllers/plans/events_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# frozen_string_literal: true | ||
|
||
module Plans | ||
class EventsController < ApplicationController | ||
before_action :authenticate_account! | ||
before_action :load_plan | ||
before_action :load_event, only: %w(edit update destroy) | ||
|
||
def index | ||
@events = Event::FindAll | ||
.call(plan_id: @plan.id) | ||
.value! | ||
end | ||
|
||
def new | ||
@event_form = Event::Create::Form.new | ||
end | ||
|
||
def create | ||
response = Event::Create.call( | ||
**input_data_for_create | ||
) | ||
|
||
if response.success? | ||
flash[:notice] = "Nuevo evento creado!" | ||
redirect_to plan_events_path(@plan.id) | ||
else | ||
flash.now[:alert] = "Algo ha ido mal!" | ||
@event = response.value.data | ||
render :new | ||
end | ||
end | ||
|
||
def edit | ||
@event_form = Event::Update::Form.new( | ||
@event.attributes | ||
.slice(:plan_id, :picto_id, :title, :day_of_the_week) | ||
.merge(event_id: params[:id]) | ||
) | ||
end | ||
|
||
def update | ||
response = Event::Update.call( | ||
**input_data_for_update | ||
) | ||
|
||
if response.success? | ||
flash[:notice] = "Evento editado!" | ||
redirect_to plan_events_path(response.value.id) | ||
else | ||
flash.now[:alert] = "Algo ha ido mal!" | ||
@event_form = response.value.data | ||
render :edit | ||
end | ||
end | ||
|
||
def destroy | ||
Event::Remove.call( | ||
plan_id: @plan.id, | ||
event_id: params[:id] | ||
) | ||
|
||
redirect_to plan_events_path(@plan.id) | ||
end | ||
|
||
private | ||
|
||
def load_event | ||
@event = Event::Find.call( | ||
plan_id: @plan.id, | ||
event_id: params[:id] | ||
).value! | ||
end | ||
|
||
def input_data_for_create | ||
params | ||
.require(:event_create_form) | ||
.permit(:picto_id, :title, :day_of_the_week) | ||
.merge(plan_id: @plan.id) | ||
end | ||
|
||
def input_data_for_update | ||
params | ||
.require(:event_update_form) | ||
.permit(:picto_id, :title, :day_of_the_week) | ||
.merge(plan_id: @plan.id, event_id: params[:id]) | ||
end | ||
|
||
def load_plan | ||
@plan = Plan::Find | ||
.call(account_id: current_account.id, plan_id: params[:plan_id]) | ||
.value! | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.