bitnami redmine3.2.0插件开发
来源:互联网 发布:夏宽大师 淘宝 编辑:程序博客网 时间:2024/06/07 23:37
参考资料
Redmine插件开发
redmine自定义插件开发
Ruby on Rails 学习(一)——浅谈MVC框架
http://www.jianshu.com/p/a725d6a1a2c9
Ruby on Rails,通过实例变量从Controller向View传递数据
http://blog.csdn.net/abbuggy/article/details/7627460
Ruby on Rails,在Controller中指定页面重定向
http://blog.csdn.net/abbuggy/article/details/7626606
Ruby on Rails,在Controller中指定渲染的Templates
http://blog.csdn.net/abbuggy/article/details/7555423
Ruby on Rails,Routes配置routes.rb及请求解析规则
http://blog.csdn.net/abbuggy/article/details/7516224
Ruby on Rails,创建最简单的视图/控制器单元Hello World
http://blog.csdn.net/abbuggy/article/details/7409445
ruby on rails 中render的使用
http://blog.csdn.net/cloudcraft/article/details/9457279
网上搜redmine插件开发,上来直接说运行bundle等命令,提示command not found。实际bitnami redmine已经安装好了插件相关开发环境,需要利用use_redmine命令进入该开发环境命令行后才能执行相关命令。
在redmine安装根目录可以找到use_redmine程序,
1、运行redmine相关的服务,进入命令行,在redmine安装根目录执行./use_redmine
2、export RAILS_ENV="production"。必须执行该命令,否则在执行第3布时会报下面的错误redmine-3.2.0-0/ruby/lib/ruby/gems/2.0.0/gems/mysql2-0.3.14/lib/mysql2/client.rb:67:in `connect': Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) (Mysql2::Error)
3、进入apps/redmine/htdocs目录,执行bundle exec ruby bin/rails generate redmine_plugin polls,创建了一个poll插件。网上资料中都是bundle script/rails,需要改成bin,redmine官网有说明You need to useruby bin/rails
or rails
on Redmine 3.x (Rails 4)
4、bundle exec ruby bin/rails generate redmine_plugin_model polls poll,创建一个model层。ruby on rails采用MVC架构开发web。
5、bundle exec ruby bin/rails generate redmine_plugin_controller Polls polls index,创建视图层,默认生成index方法和对应的网页文件
6、给插件添加菜单,修改init.rb文件,内容如下
Redmine::Plugin.register :polls do
name 'Polls plugin'
author 'Author name'
description 'This is a plugin for Redmine'
version '0.0.1'
url 'http://example.com/path/to/plugin'
author_url 'http://example.com/about'
menu :top_menu, :polls, { :controller => 'polls', :action =>
'index' }, :caption => 'Polls'
end
7、关键的一步,搜索的资料中都没有提到!!!需要为插件添加路由,在点击网页的菜单时可以调用正确的方法,否则日志文件中会报no routes错误。修改config目录中的routes.rb文件,内容如下:
RedmineApp::Application.routes.draw do
match 'polls/:action', :to => 'polls#index', :via => [:get, :post]
end
8、修改controller.rb文件,内容如下
class PollsController < ApplicationController
unloadable
def index
scope = Project.visible.sorted
respond_to do |format|
format.html {
unless params[:closed]
scope = scope.active
end
@projects = scope.to_a
}
format.api {
@offset, @limit = api_offset_and_limit
@project_count = scope.count
@projects = scope.offset(@offset).limit(@limit).to_a
}
format.atom {
projects = scope.reorder(:created_on => :desc).limit(Setting.feeds_limit.to_i).to_a
render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
}
end
end
end
9、修改app/helpers目录中的polls_helper.rb文件,内容如下,这段代码是从redmine源码的project_helper.rb中找到的:
module PollsHelper
def render_project_hierarchy(projects)
render_project_nested_lists(projects) do |project|
s = link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}")
if project.description.present?
s << content_tag('div', textilizable(project.short_description, :project => project), :class => 'wiki description')
end
s
end
end
end
10、修改app/views/polls目录中的index.html.erb,@projects是在controller中定义的实体变量可以直接在html.erb文件中访问。内容如下:
<h2>PollsController#index</h2>
<div id="projects-index">
<%= render_project_hierarchy(@projects) %>
</div>
11、重启redmine,点击polls菜单,可以看到所有创建的工程。该插件实现了project页面的功能,可点击工程名跳转到对应项目页面。
感谢网上大神们的相关资料,让我能走通插件创建这条路,特别是解决Bitnami-redmine安装scrum插件的问题
这篇博客解决了最关键的问题:运行use_redmine,打开了我redmine插件安装之路、插件开发之门,感激。
- bitnami redmine3.2.0插件开发
- bitnami redmine3.2.0插件安装
- Bitnami Redmine安装插件
- bitnami redmine 安装插件
- redmine3.3.1安装与常用插件安装
- bitnami redmine 插件的安装
- linux下redmine3.3迁移、升级、插件备忘录
- bitnami redmine agile插件、scrum插件使用说明
- BitNami
- BitNami
- bitnami redmine安装插件code review
- bitnami-redmine-2.x 安装插件
- linux下bitnami-redmine中安装插件redmine_dmsf总结
- Debian安装redmine3.2.2
- redmine3.3.0安装问题
- XAMPP BitNami
- Bitnami Redmine
- ubuntu14.04 配置redmine3.1
- java concurrent
- 【云星数据---Apache Flink实战系列(精品版)】:Apache Flink批处理API详解与编程实战026--DateSet实用API详解026
- 地图投影和矢量瓦片详解
- SpringMvc之值获取Session的两种方法-yellowcong
- 怎样获取form-data方式POST的数据
- bitnami redmine3.2.0插件开发
- js获取当前时间是本年第几周
- 设计模式入门篇——EIT造型
- 【云星数据---Apache Flink实战系列(精品版)】:Apache Flink批处理API详解与编程实战027--DateSet实用API详解027
- 这5个方面让你具备真正的交互设计思维
- 【unity】unity相关内容---链接传送门
- PAT乙级1065
- 球钟问题的解决--栈和队列
- Oracle数据库