Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanuan committed Jul 31, 2011
2 parents 8489702 + aa7d899 commit 27ded66
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 9 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ List of contributors:

* Kang-min Liu <gugod@gugod.org>
* John Yani <vanuan@gmail.com>
* Websiteburo (Henri Bourcereau) <devel@websiteburo.com>

5 changes: 5 additions & 0 deletions Changes → HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
0.0.4:
- Add a default format to settings.
- Add a page files directory for new created wikis. (requires gollum version => 1.2.0)
- Fix a bug when creating new wiki.

0.0.3:
- Let the content style match the style of builtin Wiki

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Gollum is a wiki system that powers GitHub Wikis (https://github.com/github/goll

A gollum wiki is a git repository that contains simple text files.

You can set a base path for you wikis if you want all wikis to be in the specific folder.
You can set a base path for all of your wikis if you want all wikis to be in the specific folder.

You can also go to project settings and set a custom wiki git path.

Expand All @@ -17,9 +17,9 @@ The wiki will be created when you go to a plugin tab. Old wikis will not be dele
Be caution:

- The code is pretty alpha quality now, backward-incompatible changes are likely to be introduced in the future.
- It only support markdown (at the moment)
- It requires your redmine process (passenger / mongrel... whatever) to be able to write your git repositories
- Depending on your git server setup, you still need to configure the access control for the newly create wiki repositories
- IT DOES NOT IMPORT YOUR CURRENT WIKI CONTENT
- If you change the wiki path, it will NOT be moved
- You should have a plugin .git repository in vendor/plugins/redmine-gollum/.git
- Redmine Gollum will not warn you if you have files with the same name in one repo (but in different directories). Even if you set up different page files directory.
7 changes: 5 additions & 2 deletions app/controllers/gollum_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def update
if @page
@wiki.update_page(@page, @page.name, @page.format, params[:page][:raw_data], commit)
else
@wiki.write_page(@name, :markdown, params[:page][:raw_data], commit)
@wiki.write_page(@name, @project.gollum_wiki.markup_language.to_sym, params[:page][:raw_data], commit)
end

redirect_to :action => :show, :id => @name
Expand Down Expand Up @@ -64,6 +64,9 @@ def find_project
Grit::Repo.init_bare(git_path)
end

@wiki = Gollum::Wiki.new(git_path, :base_path => gollum_index_path(:project_id => @project.identifier))
wiki_dir = @project.gollum_wiki.directory

@wiki = Gollum::Wiki.new(git_path, :base_path => gollum_index_path(:project_id => @project.identifier), :page_file_dir => wiki_dir)

end
end
8 changes: 5 additions & 3 deletions app/controllers/gollum_wikis_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ def index
redirect_to :action => :show
end

def create
update
end

def update
gollum_wiki =
GollumWiki.first(:conditions => ["project_id = ?", @project.id]) ||
GollumWiki.new( :project_id => @project.id )
gollum_wiki = @project.gollum_wiki
gollum_wiki.attributes = params[:gollum_wiki]
if gollum_wiki.save
flash[:notice] = t(:gollum_wiki_updated)
Expand Down
8 changes: 8 additions & 0 deletions app/views/gollum_wikis/_edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
<%= label(:gollum_wiki, :git_path) %>
<%= f.text_field :git_path %>
</p>
<p>
<%= label(:gollum_wiki, :markup_language) %>
<%= select_tag(:markup_language, options_for_select(Gollum::Page::FORMAT_NAMES.keys)) %></p>
</p>
<p>
<%= label(:gollum_wiki, :page_files_directory) %>
<%= f.text_field :directory %>
</p>
</div>

<p><%= f.submit %></p>
Expand Down
4 changes: 4 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ en:
Gollum: 'Gollum'
gollum_wiki_updated: 'Gollum settings saved'
gollum_wiki_update_error: 'Gollum settings are not saved'
field_git_path: 'Git repository path'
field_markup_language: 'Markup language'
field_page_files_directory: 'Wiki pages directory'

8 changes: 8 additions & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
fr:
Gollum: 'Gollum'
gollum_wiki_updated: 'Paramètres Gollum enregistrés'
gollum_wiki_update_error: "Les paramètres Gollum n'ont pas été sauvés"
field_git_path: 'Chemin vers le référentiel Git'
field_markup_language: 'Markup language'
field_page_files_directory: 'Répertoire de stockage des pages wiki'

9 changes: 9 additions & 0 deletions db/migrate/002_add_markup_language_to_gollum_wikis.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class AddMarkupLanguageToGollumWikis < ActiveRecord::Migration
def self.up
add_column :gollum_wikis, :markup_language, :string, :default => 'textile'
end

def self.down
remove_column :gollum_wikis, :markup_language
end
end
9 changes: 9 additions & 0 deletions db/migrate/003_add_directory_to_gollum_wikis.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class AddDirectoryToGollumWikis < ActiveRecord::Migration
def self.up
add_column :gollum_wikis, :directory, :string, :default => 'doc'
end

def self.down
remove_column :gollum_wikis, :directory
end
end
4 changes: 2 additions & 2 deletions init.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'grit'
require 'gollum'
require 'gollum' # min version 1.2.0
require 'redmine'
require 'dispatcher'

Expand Down Expand Up @@ -45,7 +45,7 @@
permission :edit_gollum_pages, :gollum => [:edit, :update]
permission :delete_gollum_pages, :gollum => [:destroy]

permission :manage_gollum_wiki, :gollum_wikis => [:index,:show, :update]
permission :manage_gollum_wiki, :gollum_wikis => [:index,:show, :create, :update]
end

menu :project_menu, :gollum, { :controller => :gollum, :action => :index }, :caption => 'Gollum', :before => :wiki, :param => :project_id
Expand Down

0 comments on commit 27ded66

Please sign in to comment.