Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
crabgrass
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
45
Issues
45
List
Boards
Labels
Milestones
Merge Requests
3
Merge Requests
3
Packages
Packages
Container Registry
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
riseuplabs
crabgrass
Commits
5cead42b
Commit
5cead42b
authored
May 21, 2019
by
azul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup: unused abstract url helper for page `items`
parent
ad994069
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
62 deletions
+0
-62
app/helpers/common/page/url_helper.rb
app/helpers/common/page/url_helper.rb
+0
-62
No files found.
app/helpers/common/page/url_helper.rb
deleted
100644 → 0
View file @
ad994069
# We have a very flexible but yet restful routes for page items.
# They allow specifying the controller while still having the default
# restful properties and creating the normal named routes.
#
# It's a bit cumbersome though to always specify the page and the controller.
# So we add meaningful defaults to the named_route helpers here.
#
# What are meaningful defaults? Most page types have at least two controllers.
# One for the page itself and one for its items. So we want the second one.
# In order for this to work you have to make sure though the default controller
# for the items is listed at the second position in the init.rb file of the page.
#
# We only use the _url helpers for these - not the _path ones.
# Why?
# because the url includes https as the protocol. So even if the html snippet
# get's displayed out of context it will not initiate an unencrypted connection
# by accident. We can discuss this choice though.
# *azul
module
Common::Page::UrlHelper
def
sort_page_items_url
(
*
args
)
add_page_item_defaults_to_args!
args
super
end
def
page_items_url
(
*
args
)
add_page_item_defaults_to_args!
args
super
end
def
page_item_url
(
*
args
)
add_page_item_defaults_to_args!
args
super
end
def
edit_page_item_url
(
*
args
)
add_page_item_defaults_to_args!
args
super
end
def
add_page_defaults_to_args!
(
args
)
if
@page
.
present?
# use the default item controller not the main one
controller
=
@page
.
controller
add_defaults_to_args!
args
,
page_id:
@page
,
controller:
controller
end
end
def
add_page_item_defaults_to_args!
(
args
)
if
@page
.
present?
# use the default item controller not the main one
controller
=
@page
.
controllers
.
second
||
@page
.
controller
add_defaults_to_args!
args
,
page_id:
@page
,
controller:
controller
end
end
def
add_defaults_to_args!
(
args
,
defaults
=
{})
arg_options
=
args
.
extract_options!
arg_options
.
reverse_merge!
defaults
args
<<
arg_options
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment