-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of Charcoal-SE/metasmoke
- Loading branch information
Showing
43 changed files
with
823 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Place all the styles related to the DomainLinks controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ | ||
|
||
.domain-link { | ||
padding: 0.5em 0; | ||
border-top: 1px solid #ddd; | ||
border-bottom: 1px solid #ddd; | ||
|
||
& + .domain-link { | ||
border-top: 0; | ||
} | ||
|
||
blockquote { | ||
border-left: 4px solid #ddd; | ||
padding-left: 1em; | ||
font-size: 1em; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# frozen_string_literal: true | ||
|
||
class DomainLinksController < ApplicationController | ||
before_action :verify_core | ||
before_action :set_link, except: :create | ||
|
||
def create | ||
@link = DomainLink.new link_params.merge(creator: current_user) | ||
if @link.save | ||
Rails.cache.delete :domain_link_types | ||
render partial: 'domain_links/link', locals: { link: @link, domain: @link.left } | ||
else | ||
render json: { success: false }, status: 500 | ||
end | ||
end | ||
|
||
def update | ||
if @link.update link_params | ||
render partial: 'domain_links/link', locals: { link: @link, domain: @link.left } | ||
else | ||
render json: { success: false }, status: 500 | ||
end | ||
end | ||
|
||
def destroy | ||
if @link.destroy | ||
redirect_back fallback_location: root_path | ||
else | ||
flash[:danger] = 'Failed to remove link.' | ||
redirect_back fallback_location: @link.left | ||
end | ||
end | ||
|
||
private | ||
|
||
def link_params | ||
params.require(:domain_link).permit(:left_id, :right_id, :comments, :link_type) | ||
end | ||
|
||
def set_link | ||
@link = DomainLink.find params[:id] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
module DomainLinksHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.