Skip to content

Commit

Permalink
Merge pull request #1095 from sparc-request/sj-fixing_step_link_disable
Browse files Browse the repository at this point in the history
SJ - fixing step link disable
  • Loading branch information
Stuart-Johnson committed Aug 23, 2017
2 parents ba581f9 + 47b4245 commit 79206a1
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 16 deletions.
3 changes: 3 additions & 0 deletions app/assets/stylesheets/proper/steps.sass
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@
.step-text:hover, .right-arrow:hover
cursor: pointer

.disabled_steps
pointer-events: none

.step-btn:focus
outline: 0

Expand Down
22 changes: 15 additions & 7 deletions app/helpers/service_requests_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,21 @@ def save_as_draft_button(sub_service_request_id=nil)
remote: true, class: 'btn btn-default'
end

def step_nav_button(text, color, url)
link_to(
content_tag(:div, raw(text), class: "btn step-text")+
content_tag(:div, '', class: "right-arrow"),
url,
class: "step-btn step-btn-#{color}"
)
def step_nav_button(text, color, url, inactive_link)
if inactive_link
content_tag(:div,
content_tag(:div, raw(text), class: "btn step-text")+
content_tag(:div, '', class: "right-arrow"),
class: "step-btn step-btn-#{color} disabled_steps"
)
else
link_to(
content_tag(:div, raw(text), class: "btn step-text")+
content_tag(:div, '', class: "right-arrow"),
url,
class: "step-btn step-btn-#{color}"
)
end
end

def display_ssr_id(sub_service_request)
Expand Down
2 changes: 1 addition & 1 deletion app/views/service_requests/confirmation.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
-# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
= javascript_include_tag 'confirmation'

= render '/service_requests/navigation/steps', service_request: @service_request, sub_service_request: @sub_service_request, step_text: @step_text, css_class: @css_class
= render '/service_requests/navigation/steps', service_request: @service_request, sub_service_request: @sub_service_request, step_text: @step_text, css_class: @css_class, inactive_link: true
.col-sm-12.body-container#confirmation-page
= form_tag navigate_service_request_path(@service_request) do
= hidden_field_tag :location, ''
Expand Down
16 changes: 8 additions & 8 deletions app/views/service_requests/navigation/_steps.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,26 @@
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
-# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- subsidy, klass = calculate_step_params(service_request, sub_service_request)

- inactive_link ||= false
.col-sm-12.no-padding.steps
.container-fluid.no-padding
.steps-banner-container
%ul.no-padding.no-margin#steps-banner
%li{ class: klass }
= step_nav_button(t(:proper)[:navigation][:steps][:step1], 'blue', catalog_service_request_path(service_request, sub_service_request_id: sub_service_request.try(:id)))
= step_nav_button(t(:proper)[:navigation][:steps][:step1], 'blue', catalog_service_request_path(service_request, sub_service_request_id: sub_service_request.try(:id)), inactive_link)
%li{ class: klass }
= step_nav_button(t(:proper)[:navigation][:steps][:step2], 'blue-green', protocol_service_request_path(service_request, sub_service_request_id: sub_service_request.try(:id)))
= step_nav_button(t(:proper)[:navigation][:steps][:step2], 'blue-green', protocol_service_request_path(service_request, sub_service_request_id: sub_service_request.try(:id)), inactive_link)
%li{ class: klass }
= step_nav_button(t(:proper)[:navigation][:steps][:step3], 'green', service_details_service_request_path(service_request, sub_service_request_id: sub_service_request.try(:id)))
= step_nav_button(t(:proper)[:navigation][:steps][:step3], 'green', service_details_service_request_path(service_request, sub_service_request_id: sub_service_request.try(:id)), inactive_link)
%li{ class: klass }
= step_nav_button(t(:proper)[:navigation][:steps][:step4], 'light-blue', service_calendar_service_request_path(service_request, sub_service_request_id: sub_service_request.try(:id)))
= step_nav_button(t(:proper)[:navigation][:steps][:step4], 'light-blue', service_calendar_service_request_path(service_request, sub_service_request_id: sub_service_request.try(:id)), inactive_link)
- if subsidy
%li{ class: klass }
= step_nav_button(t(:proper)[:navigation][:steps][:step4a], 'pink', service_subsidy_service_request_path(service_request, sub_service_request_id: sub_service_request.try(:id)))
= step_nav_button(t(:proper)[:navigation][:steps][:step4a], 'pink', service_subsidy_service_request_path(service_request, sub_service_request_id: sub_service_request.try(:id)), inactive_link)
%li{ class: klass }
= step_nav_button(t(:proper)[:navigation][:steps][:step5], 'orange', document_management_service_request_path(service_request, sub_service_request_id: sub_service_request.try(:id)))
= step_nav_button(t(:proper)[:navigation][:steps][:step5], 'orange', document_management_service_request_path(service_request, sub_service_request_id: sub_service_request.try(:id)), inactive_link)
%li{ class: klass }
= step_nav_button(t(:proper)[:navigation][:steps][:step6], 'red', review_service_request_path(service_request, sub_service_request_id: sub_service_request.try(:id)))
= step_nav_button(t(:proper)[:navigation][:steps][:step6], 'red', review_service_request_path(service_request, sub_service_request_id: sub_service_request.try(:id)), inactive_link)

.col-sm-12.ui-corner-all.step-header{ class: css_class }
.col-sm-6.no-padding
Expand Down

0 comments on commit 79206a1

Please sign in to comment.