-
Notifications
You must be signed in to change notification settings - Fork 0
Using active_link_to if defined (falling back to link_to) #22
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
base: master
Are you sure you want to change the base?
Changes from all commits
6a535b0
be035c9
afc1314
e79507e
a39d3da
0d586f6
060b8c6
37e2339
cb01e52
b68097f
4a11b59
86b4f6b
984eb9c
3a7f1f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,26 +4,45 @@ def sidebar(*args, &block) | |
| options = args.extract_options! | ||
| if block_given? | ||
| content_tag :div, id: 'sidebar-wrapper' do | ||
| html = link_to '', options[:brand_url], class: 'sidebar-brand hidden-sm-down' | ||
| html << content_tag(:ul, class: 'sidebar-nav') do | ||
| concat(link_to '', options[:brand_url], class: 'sidebar-brand hidden-sm-down') | ||
| concat(content_tag(:ul, class: 'sidebar-nav') do | ||
| yield | ||
| end | ||
| html.html_safe | ||
| end) | ||
| end | ||
| end | ||
| end | ||
|
|
||
| def sidebar_item(title, url, &block) | ||
| def sidebar_item(title, url = nil, &block) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Assignment Branch Condition size for sidebar_item is too high. [16.16/15] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Method has too many lines. [11/10] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Method has too many lines. [14/10] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Method has too many lines. [17/10] |
||
| if block_given? | ||
| url = "##{generate_random_id}" unless url.present? | ||
| content_tag :li do | ||
| html = link_to("#{title} <i class='fa fa-chevron-right'></i>".html_safe, url, data: { toggle: 'collapse' }) | ||
| html << content_tag(:ul, class: 'submenu collapse', id: url.delete('#')) do | ||
| concat(link_to("#{ title } #{ arrow_icon }".html_safe, url, data: { toggle: 'collapse' })) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Space inside string interpolation detected. |
||
| concat(content_tag(:ul, class: 'submenu collapse', id: url.delete('#')) do | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. [84/80] |
||
| yield | ||
| end | ||
| html.html_safe | ||
| end) | ||
| end | ||
| else | ||
| "<li>#{link_to title, url}</li>".html_safe | ||
| smart_link_to title, url, class: 'nav-link' | ||
| end | ||
| end end | ||
| end | ||
|
|
||
| def smart_link_to(title, url, options = {}) | ||
| content_tag :li, class: 'nav-item' do | ||
| if defined?(ActiveLinkTo) | ||
| active_link_to(title, url, options) | ||
| else | ||
| link_to title, url, options | ||
| end | ||
| end | ||
| end | ||
|
|
||
| def arrow_icon | ||
| content_tag :i, class: 'fa fa-chevron-right' do | ||
| end | ||
| end | ||
|
|
||
| def generate_random_id | ||
| (0...20).map { ('a'..'z').to_a.sample }.join | ||
| end | ||
| end | ||
| end | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add parentheses to nested method call link_to '', options[:brand_url], class: 'sidebar-brand hidden-sm-down'.
Line is too long. [88/80]