Skip to content
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

Fix style of blocks and markers when default skin is not used #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions app/controllers/macros_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ class MacrosController < ApplicationController
layout 'admin'
menu_item :custom_macros

before_filter :require_admin
before_filter :find_macro, :only => [ :edit, :update, :destroy ]
before_action :require_admin
before_action :find_macro, :only => [ :edit, :update, :destroy ]

def index
@macros = WikiMacro.order(:name)
Expand All @@ -14,7 +14,7 @@ def new
end

def create
@macro = WikiMacro.new(params[:wiki_macro])
@macro = WikiMacro.new(macro_params)
if request.post? && @macro.save
flash[:notice] = l(:notice_successful_create)
@macro.register!
Expand All @@ -30,7 +30,7 @@ def edit
def update
if request.patch?
old_name = @macro.name
@macro.attributes = params[:wiki_macro]
@macro.attributes = macro_params
name_changed = @macro.name_changed?
desc_changed = @macro.description_changed?
if @macro.save
Expand Down Expand Up @@ -59,6 +59,9 @@ def destroy
end

private
def macro_params
params.require(:wiki_macro).permit(:name, :description, :content)
end

def find_macro
@macro = WikiMacro.find(params[:id])
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/mentions_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class MentionsController < ApplicationController
include ApplicationHelper

before_filter :find_user, :only => :index
before_filter :find_object_and_project, :only => :autocomplete
before_action :find_user, :only => :index
before_action :find_object_and_project, :only => :autocomplete

def index
count = 0
Expand Down
2 changes: 0 additions & 2 deletions app/models/mention.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ class Mention < ActiveRecord::Base
belongs_to :mentioned, :class_name => 'User'
belongs_to :mentioning, :polymorphic => true

attr_protected :id

before_save :set_created_on
after_create :send_notification

Expand Down
2 changes: 0 additions & 2 deletions app/models/wiki_macro.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ class WikiMacro < ActiveRecord::Base

validate :validate_name

attr_protected :id

MACRO_ARGUMENT_RE = %r{%(url)?(?:\{([^{=}]*)\}|\[([0-9]*)\]|\((\**)\))}

def to_s
Expand Down
13 changes: 8 additions & 5 deletions assets/stylesheets/wiking.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@ span.wiking-hidden {
opacity: 0.25;
filter: alpha(opacity=25);
}
div.wiking {
background-repeat: no-repeat;
}
div.wiking.flash {
border-width: 1px;
background-position: 6px 6px;
width: auto;
overflow-x: auto;
overflow-y: hidden;
font-size: 10pt;
font-size: 1.1em;
padding: 6px 4px 6px 30px;
margin-bottom: 12px;
border: 1px solid;
border-radius: 3px
}
div.wiking.warning {
background-image: url(../images/warning.png);
Expand All @@ -28,19 +34,16 @@ div.wiking.warning {
div.wiking.notice {
background-image: url(../images/notice.png);
background-position: 6px 4px;
background-repeat: no-repeat;
background-color: #c5e7f8;
border-color: #759fcf;
color: #00365f;
}
div.wiking.tip {
background-image: url(../images/tip.png);
background-repeat: no-repeat;
background-color: #eee;
border-color: #bbb;
}
span.wiking.marker {
background-repeat: no-repeat;
display: inline-block;
}
span.wiking.marker-left,
Expand Down
30 changes: 15 additions & 15 deletions init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,56 +6,56 @@

Rails.configuration.to_prepare do
unless Redmine::WikiFormatting::Textile::Formatter.included_modules.include?(WikingFormatterPatch)
Redmine::WikiFormatting::Textile::Formatter.send(:include, WikingFormatterPatch)
Redmine::WikiFormatting::Textile::Formatter.send(:prepend, WikingFormatterPatch)
end
unless Redmine::WikiFormatting::Textile::Helper.included_modules.include?(WikingWikiHelperPatch)
Redmine::WikiFormatting::Textile::Helper.send(:include, WikingWikiHelperPatch)
Redmine::WikiFormatting::Textile::Helper.send(:prepend, WikingWikiHelperPatch)
end
unless Redmine::WikiFormatting::Macros::Definitions.included_modules.include?(WikingMacrosDefinitionsPatch)
Redmine::WikiFormatting::Macros::Definitions.send(:include, WikingMacrosDefinitionsPatch)
Redmine::WikiFormatting::Macros::Definitions.send(:prepend, WikingMacrosDefinitionsPatch)
end
unless ApplicationHelper.included_modules.include?(WikingApplicationHelperPatch)
ApplicationHelper.send(:include, WikingApplicationHelperPatch)
ApplicationHelper.send(:prepend, WikingApplicationHelperPatch)
end

unless Redmine::Export::PDF::ITCPDF.included_modules.include?(WikingPDFPatch)
Redmine::Export::PDF::ITCPDF.send(:include, WikingPDFPatch)
Redmine::Export::PDF::ITCPDF.send(:prepend, WikingPDFPatch)
end

unless JournalsController.included_modules.include?(WikingLlControllerPatch)
JournalsController.send(:include, WikingLlControllerPatch)
JournalsController.send(:prepend, WikingLlControllerPatch)
end
unless MessagesController.included_modules.include?(WikingLlControllerPatch)
MessagesController.send(:include, WikingLlControllerPatch)
MessagesController.send(:prepend, WikingLlControllerPatch)
end
unless CommentsController.included_modules.include?(WikingCommentsControllerPatch)
CommentsController.send(:include, WikingCommentsControllerPatch)
CommentsController.send(:prepend, WikingCommentsControllerPatch)
end

unless User.included_modules.include?(WikingUserPatch)
User.send(:include, WikingUserPatch)
User.send(:prepend, WikingUserPatch)
end

unless WikiContent.included_modules.include?(WikingContentPatch)
WikiContent.send(:include, WikingContentPatch)
WikiContent.send(:prepend, WikingContentPatch)
end
unless Comment.included_modules.include?(WikingCommentPatch)
Comment.send(:include, WikingCommentPatch)
Comment.send(:prepend, WikingCommentPatch)
end
unless Journal.included_modules.include?(WikingJournalPatch)
Journal.send(:include, WikingJournalPatch)
Journal.send(:prepend, WikingJournalPatch)
end

unless Redmine::Notifiable.included_modules.include?(WikingNotifiablePatch)
Redmine::Notifiable.send(:include, WikingNotifiablePatch)
Redmine::Notifiable.send(:prepend, WikingNotifiablePatch)
end
unless Mailer.included_modules.include?(WikingMailerPatch)
Mailer.send(:include, WikingMailerPatch)
Mailer.send(:prepend, WikingMailerPatch)
end

for model in [ Issue, Journal ]
unless Issue.included_modules.include?(WikingNotifiedUsersPatch)
Issue.send(:include, WikingNotifiedUsersPatch)
Issue.send(:prepend, WikingNotifiedUsersPatch)
end
end
end
Expand Down
27 changes: 15 additions & 12 deletions lib/wiking_application_helper_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@

module WikingApplicationHelperPatch

def self.included(base)
base.extend(ClassMethods)
base.send(:include, InstanceMethods)
def self.prepended(base)
base.prepend(ClassMethods)
base.send(:prepend, InstanceMethods)
base.class_eval do
unloadable

alias_method_chain :textilizable, :wiking
alias_method_chain :parse_headings, :wiking
alias_method_chain :parse_wiki_links, :wiking
alias_method_chain :parse_redmine_links, :wiking
# alias_method_chain :parse_headings, :wiking
alias_method :textilizable_without_wiking, :textilizable
alias_method :textilizable, :textilizable_with_wiking
alias_method :parse_wiki_links_without_wiking, :parse_wiki_links
alias_method :parse_wiki_links, :parse_wiki_links_with_wiking
alias_method :parse_redmine_links_without_wiking, :parse_redmine_links
alias_method :parse_redmine_links, :parse_redmine_links_with_wiking

alias_method_chain :link_to_user, :login
# alias_method_chain :link_to_user, :login

define_method :parse_wiking_conditions, instance_method(:parse_wiking_conditions)
define_method :parse_glyphs, instance_method(:parse_glyphs)
Expand Down Expand Up @@ -185,11 +188,11 @@ def textilizable_with_wiking(*args)
text
end

def parse_headings_with_wiking(text, project, obj, attr, only_path, options)
def parse_headings(text, project, obj, attr, only_path, options)
parse_wiking_conditions(text, project, obj, attr, only_path, options)
parse_glyphs(text, project, obj, attr, only_path, options)

parse_headings_without_wiking(text, project, obj, attr, only_path, options)
super(text, project, obj, attr, only_path, options)

parse_footnotes(text, project, obj, attr, only_path, options)
end
Expand Down Expand Up @@ -414,7 +417,7 @@ def inline_arrows(text)
end
end

def link_to_user_with_login(user, options = {})
def link_to_user(user, options = {})
if user.is_a?(User) && user.active? && user.login.match(%r{\A[a-z0-9_\-]+\z}i) && user.login != 'current'
name = h(user.name(options[:format]))
if Redmine::Plugin.installed?(:redmine_people) && User.current.allowed_people_to?(:view_people, user)
Expand All @@ -423,7 +426,7 @@ def link_to_user_with_login(user, options = {})
link_to(name, { :controller => 'users', :action => 'show', :id => user.login.downcase }, :class => user.css_classes)
end
else
link_to_user_without_login(user, options)
super(user, options)
end
end

Expand Down
6 changes: 3 additions & 3 deletions lib/wiking_comment_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

module WikingCommentPatch

def self.included(base)
base.send(:include, InstanceMethods)
base.send(:include, VisibleMethod) unless base.method_defined?(:visible?)
def self.prepended(base)
base.send(:prepend, InstanceMethods)
base.send(:prepend, VisibleMethod) unless base.method_defined?(:visible?)
base.class_eval do
unloadable
end
Expand Down
4 changes: 2 additions & 2 deletions lib/wiking_comments_controller_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

module WikingCommentsControllerPatch

def self.included(base)
base.send(:include, InstanceMethods)
def self.prepended(base)
base.send(:prepend, InstanceMethods)
base.class_eval do
unloadable
end
Expand Down
4 changes: 2 additions & 2 deletions lib/wiking_content_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

module WikingContentPatch

def self.included(base)
base.send(:include, InstanceMethods)
def self.prepended(base)
base.send(:prepend, InstanceMethods)
base.class_eval do
unloadable
end
Expand Down
6 changes: 3 additions & 3 deletions lib/wiking_formatter_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

module WikingFormatterPatch

def self.included(base)
base.extend(ClassMethods)
base.send(:include, InstanceMethods)
def self.prepended(base)
base.prepend(ClassMethods)
base.send(:prepend, InstanceMethods)
base.class_eval do
include Redmine::I18n

Expand Down
4 changes: 2 additions & 2 deletions lib/wiking_journal_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

module WikingJournalPatch

def self.included(base)
base.send(:include, VisibleMethod) unless base.method_defined?(:visible?)
def self.prepended(base)
base.send(:prepend, VisibleMethod) unless base.method_defined?(:visible?)
base.class_eval do
unloadable
end
Expand Down
4 changes: 2 additions & 2 deletions lib/wiking_ll_controller_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

module WikingLlControllerPatch

def self.included(base)
base.send(:include, InstanceMethods)
def self.prepended(base)
base.send(:prepend, InstanceMethods)
base.class_eval do
unloadable
end
Expand Down
16 changes: 8 additions & 8 deletions lib/wiking_macros_definitions_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

module WikingMacrosDefinitionsPatch

def self.included(base)
base.send(:include, InstanceMethods)
def self.prepended(base)
base.send(:prepend, InstanceMethods)
base.class_eval do
unloadable

alias_method_chain :macro_exists?, :custom
alias_method_chain :exec_macro, :custom
# alias_method_chain :macro_exists?, :custom
# alias_method_chain :exec_macro, :custom
end
end

module InstanceMethods

def macro_exists_with_custom?(name)
exists = macro_exists_without_custom?(name)
def macro_exists?(name)
exists = super?(name)
unless exists
if macro = WikiMacro.find_by_name(name)
macro.register!
Expand All @@ -25,7 +25,7 @@ def macro_exists_with_custom?(name)
exists
end

def exec_macro_with_custom(*args)
def exec_macro(*args)
method_name = "macro_#{args[0].downcase}"
unless respond_to?(method_name)
macro = WikiMacro.find_by_name(args[0])
Expand All @@ -36,7 +36,7 @@ def exec_macro_with_custom(*args)
macro.register! unless Redmine::WikiFormatting::Macros.available_macros.has_key?(macro.name.to_sym)
end
end
exec_macro_without_custom(*args)
super(*args)
end

end
Expand Down
Loading