From c335ec3b294ae0aa76dac92040be57a5f704498a Mon Sep 17 00:00:00 2001 From: Nihal Mohammed Date: Fri, 14 May 2021 20:31:04 +0530 Subject: [PATCH] # This is a combination of 5 commits.tree d6d4f31283e42c44c9c4d116567ce7b1a99a13ab parent b680697af61d67ce8312fcc4ce4d9092fbc78a5e author Nihal Mohammed 1621004464 +0530 committer Nihal Mohammed 1621022463 +0530 # This is a combination of 4 commits. # This is the 1st commit message: Add advanced settings button to incoming and outgoing pages in OC cycle edit # This is the commit message #2: Remove extra header text # This is the commit message #3: Moved repeating code blocks to partial # This is the commit message #4: Refactored code # This is the commit message #5: Delete _advanced_settings_hidden.html.haml --- .../_order_cycle_top_buttons.haml | 19 +++++++++++++++++++ .../admin/order_cycles/incoming.html.haml | 17 +++++++++++++++++ .../admin/order_cycles/outgoing.html.haml | 17 +++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 app/views/admin/order_cycles/_order_cycle_top_buttons.haml diff --git a/app/views/admin/order_cycles/_order_cycle_top_buttons.haml b/app/views/admin/order_cycles/_order_cycle_top_buttons.haml new file mode 100644 index 0000000000..97b14ddf1b --- /dev/null +++ b/app/views/admin/order_cycles/_order_cycle_top_buttons.haml @@ -0,0 +1,19 @@ +- content_for :page_actions do + :javascript + function toggleSettings(){ + if( $('#advanced_settings').is(":visible") ){ + $('button#toggle_settings i').switchClass("icon-chevron-up","icon-chevron-down") + } + else { + $('button#toggle_settings i').switchClass("icon-chevron-down","icon-chevron-up") + } + $("#advanced_settings").slideToggle() + } + + %li + %button#toggle_settings{ onClick: 'toggleSettings()' } + = t('.advanced_settings') + %i.icon-chevron-down + +#advanced_settings{ hidden: true } + = render partial: "/admin/order_cycles/advanced_settings" \ No newline at end of file diff --git a/app/views/admin/order_cycles/incoming.html.haml b/app/views/admin/order_cycles/incoming.html.haml index faaa81e03b..3bc3dd86b3 100644 --- a/app/views/admin/order_cycles/incoming.html.haml +++ b/app/views/admin/order_cycles/incoming.html.haml @@ -1,3 +1,20 @@ +- content_for :page_actions do + :javascript + function toggleSettings(){ + if( $('#advanced_settings').is(":visible") ){ + $('button#toggle_settings i').switchClass("icon-chevron-up","icon-chevron-down") + } + else { + $('button#toggle_settings i').switchClass("icon-chevron-down","icon-chevron-up") + } + $("#advanced_settings").slideToggle() + } + + %li + %button#toggle_settings{ onClick: 'toggleSettings()' } + = t('.advanced_settings') + %i.icon-chevron-down + - content_for :page_title do = t :edit_order_cycle diff --git a/app/views/admin/order_cycles/outgoing.html.haml b/app/views/admin/order_cycles/outgoing.html.haml index 0623d1f71e..890faa9553 100644 --- a/app/views/admin/order_cycles/outgoing.html.haml +++ b/app/views/admin/order_cycles/outgoing.html.haml @@ -1,3 +1,20 @@ +- content_for :page_actions do + :javascript + function toggleSettings(){ + if( $('#advanced_settings').is(":visible") ){ + $('button#toggle_settings i').switchClass("icon-chevron-up","icon-chevron-down") + } + else { + $('button#toggle_settings i').switchClass("icon-chevron-down","icon-chevron-up") + } + $("#advanced_settings").slideToggle() + } + + %li + %button#toggle_settings{ onClick: 'toggleSettings()' } + = t('.advanced_settings') + %i.icon-chevron-down + - content_for :page_title do = t :edit_order_cycle