-
-
Notifications
You must be signed in to change notification settings - Fork 315
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
Move logic from link dialog - Javascript onto the server #2756
Move logic from link dialog - Javascript onto the server #2756
Conversation
5d72127
to
2277f0f
Compare
Use our default page selector also in link dialog. Let the controller resolve the page url and prefill the page selector to reduce the amount of necessary Javascript.
a66e49b
to
51cff27
Compare
e258364
to
856b036
Compare
Try to migrate the link dialog partials into view component to make it easier extendable and lesser repetitive. In a later commit it will be configurable to allow other plugins to add their own tabs.
856b036
to
5eb35f8
Compare
Remove the custom logic to initialize and selecting the correct tab and instead pre-configer the link dialog template. The handling of the anchor is still tricky and will be resolved in the next commit.
e094c8b
to
fa0755b
Compare
add an anchor select component to fetch the anchors from the API or from the preview of the page editor. The selected anchor will be attached at the url.
db50800
to
f83191d
Compare
|
||
get pageId() { | ||
return this.selection ? JSON.parse(this.selection)["id"] : undefined | ||
} |
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.
do we need this?
raise ArgumentError, "The tab needs to have a title" | ||
end | ||
|
||
def type |
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.
def name
<sl-tab-panel name="overlay_tab_file_link"> | ||
<%= render partial: 'file_link' %> | ||
</sl-tab-panel> | ||
<% tabs = [Alchemy::Admin::Pages::InternalTab, Alchemy::Admin::Pages::AnchorTab, Alchemy::Admin::Pages::ExternalTab, Alchemy::Admin::Pages::FileTab] %> |
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.
Would be nice to have this configurable
<%= render partial: 'file_link' %> | ||
</sl-tab-panel> | ||
<% tabs = [Alchemy::Admin::Pages::InternalTab, Alchemy::Admin::Pages::AnchorTab, Alchemy::Admin::Pages::ExternalTab, Alchemy::Admin::Pages::FileTab] %> | ||
<% tabs.each do |tab| %> |
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.
Alchemy::Admin::LinkDialogTabs.each do |tab|
@@ -670,6 +670,7 @@ en: | |||
delete_user: "Delete this user" | |||
edit_user: "Edit the user´s properties." | |||
"No users found": "No users found." | |||
url: "Url" |
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.
URL
@@ -95,7 +95,7 @@ | |||
|
|||
within "[name='overlay_tab_external_link']" do | |||
expect(page).to have_selector("#external_link") | |||
fill_in("URL", with: "https://example.com") | |||
fill_in("Url", with: "https://example.com") |
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.
revert
@@ -48,64 +66,10 @@ class window.Alchemy.LinkDialog extends Alchemy.Dialog | |||
target: $("##{@link_type}_link_target").val() | |||
false | |||
|
|||
# Initializes the select2 based Page select | |||
initPageSelect: -> |
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.
This should maybe be its separate PR that builds on top of the remaining commits?
@@ -164,6 +164,9 @@ def destroy | |||
|
|||
def link | |||
@url = params[:url] | |||
@tab = params[:tab] | |||
@title = params[:title] |
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.
@link_title = params[:link_title]
@@ -164,6 +164,9 @@ def destroy | |||
|
|||
def link | |||
@url = params[:url] | |||
@tab = params[:tab] | |||
@title = params[:title] | |||
@target = params[:target] |
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.
@link_target = params[:link_target]
@@ -1,6 +1,6 @@ | |||
<sl-tab-group id="overlay_tabs"> | |||
<% tabs = [Alchemy::Admin::Pages::InternalTab, Alchemy::Admin::Pages::AnchorTab, Alchemy::Admin::Pages::ExternalTab, Alchemy::Admin::Pages::FileTab] %> | |||
<% tabs.each do |tab| %> | |||
<%= render tab.new(@url) %> | |||
<%= render tab.new(@url, @tab, @title, @target) %> |
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.
tab.new(@url, selected: @tab, link_title: @link_title, link_target: @link_target)
I extracting part of these PR into multiple, smaller Pull Requests. |
Closed in favor of #2796 |
What is this pull request for?
Checklist