Skip to content

Commit

Permalink
Add activity pages's css style code;remove use of will_paginate
Browse files Browse the repository at this point in the history
  • Loading branch information
zouchaoqun committed Feb 3, 2009
1 parent 0e9c4b3 commit b4cde43
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 43 deletions.
23 changes: 11 additions & 12 deletions README
@@ -1,4 +1,4 @@
== ezFAQ plugin 0.0.3
== ezFAQ plugin 0.0.4

This is a FAQ management plugin for Redmine

Expand All @@ -13,23 +13,22 @@ It's better to use the 2.1.0 version.

=== Plugin installation

1. Install will_paginate gem
gem install will_paginate
1. Copy the plugin directory(ezfaq_plugin) into the vendor/plugins directory

2. Add will_paginate to the last of enviroment.rb
require 'will_paginate'

3. Copy the plugin directory(ezfaq_plugin) into the vendor/plugins directory

4. Migrate plugin:
2. Migrate plugin:
rake db:migrate_plugins

5. Start Redmine
3. Start Redmine

Installed plugins are listed on 'Admin -> Information' screen.

=== Changelog

0.0.4 -> Add faq into project's activity.
Add preview ablility to new and edit page.
Use redmine's pagination instead of will_paginate(so will_paginate is no longer needed).
Add de.yml language.

0.0.3 -> Change attatchment related methods, because redmine r2116 has changed it's
attatchment manage mechanism.
Change permission and menu into gloc strings and now they can be localized.
Expand All @@ -47,13 +46,13 @@ Installed plugins are listed on 'Admin -> Information' screen.
Thanks for edavis10 at http://github.com/edavis10/ for his redmine core patch.
(Look at lib/attachment_patch.rb)

=== Language contributor
=== Language contributors

de.yml - Mathias Kühn

=== Roadmap

0.0.4 -> Generate pdf version FAQ document including all valid FAQ.
0.1.0 -> Generate pdf version FAQ document including all valid FAQ.
(note: maybe delayed, if you need this feature, please let know)


Expand Down
14 changes: 7 additions & 7 deletions app/controllers/ezfaq_controller.rb
Expand Up @@ -104,15 +104,15 @@ def destroy
end

def history
limit = per_page_option
@version_count = @faq.versions.count

page_num = params[:page].to_i < 1 ? 1 : params[:page]
@versions = @faq.versions.paginate :page => page_num, :per_page => per_page_option, :select => 'id, updater_id, updated_on, version', :order => 'version DESC'

if @versions.out_of_bounds?
@versions = @faq.versions.paginate :page => 1, :per_page => per_page_option, :select => 'id, updater_id, updated_on, version', :order => 'version DESC'
end
@version_pages = Paginator.new self, @version_count, limit, params['page']
@versions = @faq.versions.find :all, :order => 'version DESC',
:select => 'id, updater_id, updated_on, version',
:limit => limit,
:offset => @version_pages.current.offset

render :template => 'ezfaq/history.html.erb', :layout => !request.xhr?
end

def show_history_version
Expand Down
8 changes: 0 additions & 8 deletions app/helpers/ezfaq_helper.rb
Expand Up @@ -23,12 +23,4 @@ def updated_by(updated, author)
l(:label_updated_time_by, author_tag, time_tag)
end

def will_pagination_links(collection)
html = ''
pages = will_paginate(collection, :prev_label => '&#171; ' + l(:label_previous), :next_label => l(:label_next) + ' &#187;', :container => false)
html << pages if pages
html << " (#{collection.offset+1}-#{collection.offset+collection.length}/#{@version_count}) | #{l(:label_display_per_page, collection.per_page)}"
html
end

end
2 changes: 1 addition & 1 deletion app/views/ezfaq/history.html.erb
Expand Up @@ -17,4 +17,4 @@
<% end %>
</tbody>
</table>
<span class="pagination"><%= will_pagination_links @versions %></span>
<p class="pagination"><%= pagination_links_full @version_pages, @version_count %></p>
4 changes: 2 additions & 2 deletions init.rb
Expand Up @@ -21,15 +21,15 @@
require_dependency 'attachment_patch'

# Hooks
#require_dependency 'ezfaq_layouts_hook'
require_dependency 'ezfaq_layouts_hook'

RAILS_DEFAULT_LOGGER.info 'Starting ezFAQ plugin for RedMine'

Redmine::Plugin.register :ezfaq_plugin do
name 'ezFAQ plugin'
author 'Zou Chaoqun'
description 'This is a FAQ management plugin for Redmine'
version '0.0.3'
version '0.0.4'

# This plugin adds a project module
# It can be enabled/disabled at project level (Project settings -> Modules)
Expand Down
16 changes: 3 additions & 13 deletions lib/ezfaq_layouts_hook.rb
@@ -1,20 +1,10 @@
# Hooks to attach to the Redmine base layouts(for dt.faq style in activity).
class EzfaqLayoutHook < Redmine::Hook::ViewListener

# def protect_against_forgery?
# false
# end

#dt.faq { background-image: url(../plugin_assets/ezfaq_plugin/images/question.png); }

def view_layouts_base_html_head(context = { })
#self.action_name
end

def view_layouts_base_body_bottom(context = { })
#context[:action_name]
context[:controller].action_name
#debug(context)
if context[:controller].action_name == 'activity'
'<style type="text/css">dt.faq { background-image: url(/plugin_assets/ezfaq_plugin/images/question.png); }</style>'
end
end

end

0 comments on commit b4cde43

Please sign in to comment.