Module: QTimetrap::ViewModels::MainViewModelSheetHelpers
- Included in:
- MainViewModel
- Defined in:
- app/view_models/main_view_model_sheet_helpers.rb
Overview
Current sheet/project/task presentation and composition helpers.
Instance Method Summary collapse
- #current_project_name ⇒ Object
- #current_project_name=(project_name) ⇒ Object
- #current_sheet_input ⇒ Object
- #current_sheet_label ⇒ Object
- #current_task_input ⇒ Object
- #current_task_input=(task_name) ⇒ Object
- #sheet_for_task_input(task_input) ⇒ Object
Instance Method Details
#current_project_name ⇒ Object
15 16 17 |
# File 'app/view_models/main_view_model_sheet_helpers.rb', line 15 def current_project_name @current_project_name || project_from_sheet.to_s end |
#current_project_name=(project_name) ⇒ Object
27 28 29 |
# File 'app/view_models/main_view_model_sheet_helpers.rb', line 27 def current_project_name=(project_name) @current_project_name = normalize_text(project_name).strip end |
#current_sheet_input ⇒ Object
11 12 13 |
# File 'app/view_models/main_view_model_sheet_helpers.rb', line 11 def current_sheet_input current_task_input end |
#current_sheet_label ⇒ Object
7 8 9 |
# File 'app/view_models/main_view_model_sheet_helpers.rb', line 7 def current_sheet_label(*) current_project_name end |
#current_task_input ⇒ Object
19 20 21 |
# File 'app/view_models/main_view_model_sheet_helpers.rb', line 19 def current_task_input @current_task_input || task_from_sheet.to_s end |
#current_task_input=(task_name) ⇒ Object
23 24 25 |
# File 'app/view_models/main_view_model_sheet_helpers.rb', line 23 def current_task_input=(task_name) @current_task_input = normalize_text(task_name).strip end |
#sheet_for_task_input(task_input) ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'app/view_models/main_view_model_sheet_helpers.rb', line 31 def sheet_for_task_input(task_input) project = current_project_name project = selected_project if project.to_s.empty? && selected_project != '* ALL' project = normalize_text(project).strip task = normalize_text(task_input).strip raise ArgumentError, 'Project is required' if project.empty? || project == '* ALL' raise ArgumentError, 'Task is required' if task.empty? "#{project}|#{task}" end |