Run rubocop --fix-layout and remove encoding comments
This commit is contained in:
parent
fa63e6e81d
commit
ea2862fdef
283 changed files with 1164 additions and 1969 deletions
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: utf-8
|
||||
class PagesController < ApplicationController
|
||||
before_action -> { require_plugin_enabled FoodsoftWiki }
|
||||
before_action :catch_special_pages, only: [:show, :new]
|
||||
|
|
@ -33,7 +32,7 @@ class PagesController < ApplicationController
|
|||
redirect_to wiki_page_path(page.permalink) and return
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if @page.nil?
|
||||
redirect_to new_page_path(:title => params[:permalink])
|
||||
elsif @page.redirect?
|
||||
|
|
@ -61,7 +60,7 @@ class PagesController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@page = Page.new(params[:page].merge({:user => current_user}))
|
||||
@page = Page.new(params[:page].merge({ :user => current_user }))
|
||||
|
||||
if params[:preview]
|
||||
render :action => 'new'
|
||||
|
|
@ -77,7 +76,7 @@ class PagesController < ApplicationController
|
|||
|
||||
def update
|
||||
@page = Page.find(params[:id])
|
||||
@page.attributes = params[:page].merge({:user => current_user})
|
||||
@page.attributes = params[:page].merge({ :user => current_user })
|
||||
|
||||
if params[:preview]
|
||||
@page.attributes = params[:page]
|
||||
|
|
@ -92,7 +91,6 @@ class PagesController < ApplicationController
|
|||
render :action => "edit"
|
||||
end
|
||||
end
|
||||
|
||||
rescue ActiveRecord::StaleObjectError
|
||||
flash[:error] = I18n.t('pages.error_stale_object')
|
||||
redirect_to wiki_page_path(@page.permalink)
|
||||
|
|
@ -116,11 +114,11 @@ class PagesController < ApplicationController
|
|||
end
|
||||
if params[:sort]
|
||||
sort = case params[:sort]
|
||||
when "title" then "title"
|
||||
when "title_reverse" then "title DESC"
|
||||
when "last_updated" then "updated_at DESC"
|
||||
when "last_updated_reverse" then "updated_at"
|
||||
end
|
||||
when "title" then "title"
|
||||
when "title_reverse" then "title DESC"
|
||||
when "last_updated" then "updated_at DESC"
|
||||
when "last_updated_reverse" then "updated_at"
|
||||
end
|
||||
else
|
||||
sort = "title"
|
||||
end
|
||||
|
|
@ -152,7 +150,7 @@ class PagesController < ApplicationController
|
|||
|
||||
def variables
|
||||
keys = Foodsoft::ExpansionVariables.variables.keys
|
||||
@variables = Hash[keys.map {|k| [k, Foodsoft::ExpansionVariables.get(k)]}]
|
||||
@variables = Hash[keys.map { |k| [k, Foodsoft::ExpansionVariables.get(k)] }]
|
||||
render 'variables'
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ module PagesHelper
|
|||
end
|
||||
|
||||
def wikified_body(body, title = nil)
|
||||
FoodsoftWiki::WikiParser.new(data: body+"\n", params: {referer: title}).to_html(noedit: true).html_safe
|
||||
FoodsoftWiki::WikiParser.new(data: body + "\n", params: { referer: title }).to_html(noedit: true).html_safe
|
||||
rescue => e
|
||||
# try the following with line breaks: === one === == two == = three =
|
||||
content_tag :span, class: 'alert alert-error' do
|
||||
|
|
@ -22,13 +22,12 @@ module PagesHelper
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
def link_to_wikipage_by_permalink(permalink, text = nil)
|
||||
unless permalink.blank?
|
||||
page = Page.find_by_permalink(permalink)
|
||||
if page.nil?
|
||||
if text.nil?
|
||||
link_to permalink, new_page_path(:title => permalink)
|
||||
link_to permalink, new_page_path(:title => permalink)
|
||||
else
|
||||
link_to text, new_page_path(:title => permalink)
|
||||
end
|
||||
|
|
@ -65,9 +64,8 @@ module PagesHelper
|
|||
end
|
||||
|
||||
# return url for all_pages rss feed
|
||||
def all_pages_rss_url(options={})
|
||||
def all_pages_rss_url(options = {})
|
||||
token = TokenVerifier.new(['wiki', 'all']).generate
|
||||
all_pages_url({:format => 'rss', :token => token}.merge(options))
|
||||
all_pages_url({ :format => 'rss', :token => token }.merge(options))
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -76,10 +76,10 @@ class Page < ApplicationRecord
|
|||
def create_redirect
|
||||
unless old_title.blank?
|
||||
Page.create :redirect => id,
|
||||
:title => old_title,
|
||||
:body => I18n.t('model.page.redirect', :title => title),
|
||||
:permalink => Page.permalink(old_title),
|
||||
:updated_by => updated_by
|
||||
:title => old_title,
|
||||
:body => I18n.t('model.page.redirect', :title => title),
|
||||
:permalink => Page.permalink(old_title),
|
||||
:updated_by => updated_by
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue