Fixed wiki pages.

This commit is contained in:
benni 2012-10-09 02:31:10 +02:00
parent acdb331e36
commit 699fb9b233
19 changed files with 200 additions and 220 deletions

View file

@ -36,4 +36,27 @@ body {
@import "datepicker"; @import "datepicker";
// Custom styles // Custom styles
@import "foodsoft"; section {
padding-bottom: 30px;
margin-bottom: 30px;
border-bottom: 1px solid #d3d3d3;
}
// Tasks ..
.accepted {
color: #468847;
}
.unaccepted {
color: #B94A48;
}
// Wiki
#wikiContent {
.editsection {
display: none;
}
.mw-headline a {
color: @textColor;
text-decoration: none;
}
}

View file

@ -1,13 +0,0 @@
section {
padding-bottom: 30px;
margin-bottom: 30px;
border-bottom: 1px solid #d3d3d3;
}
.accepted {
color: #468847;
}
.unaccepted {
color: #B94A48;
}

View file

@ -97,6 +97,23 @@ class PagesController < ApplicationController
end end
def all def all
@pages = Page.non_redirected
@partial = params[:view] || 'recent_changes'
if params[:name]
@pages = @pages.where("title LIKE ?", "%#{params[:name]}%").limit(20).order('updated_at DESC')
@partial = 'title_list'
else
order = case @partial
when 'recent_changes' then
'updated_at DESC'
when 'site_map' then
'created_at DESC'
when 'title_list' then
'title DESC'
end
@pages.order(order)
end
end end
def version def version

View file

@ -41,10 +41,10 @@ module PagesHelper
unless toc.blank? unless toc.blank?
toc = WikiCloth.new({:data => toc, :link_handler => Wikilink.new}).to_html toc = WikiCloth.new({:data => toc, :link_handler => Wikilink.new}).to_html
section_count = 0
toc.gsub(/<li>([^<>\n]*)/) do toc.gsub(/<li>([^<>\n]*)/) do
section_count += 1 name = $1
"<li><a href='#section-#{section_count}'>#{$1}</a>" anchor = name.gsub(/\s/, '_').gsub(/[^a-zA-Z_]/, '')
"<li><a href='##{anchor}'>#{name.truncate(20)}</a>"
end.html_safe end.html_safe
end end
end end

View file

@ -6,5 +6,6 @@
einladen. einladen.
= simple_form_for [:foodcoop, @workgroup] do |f| = simple_form_for [:foodcoop, @workgroup] do |f|
= render :partial => 'shared/group_form_fields', :locals => {:f => f} = render :partial => 'shared/group_form_fields', :locals => {:f => f}
.form-actions
= f.submit = f.submit
= link_to "oder abbrechen", foodcoop_workgroups_path = link_to "oder abbrechen", foodcoop_workgroups_path

View file

@ -5,16 +5,12 @@
- unless @unaccepted_tasks.empty? && @next_tasks.empty? && @unassigned_tasks_number == 0 - unless @unaccepted_tasks.empty? && @next_tasks.empty? && @unassigned_tasks_number == 0
%section.well %section.well
%h2 Aufgaben - unless @next_tasks.empty?
-unless @next_tasks.empty? %h3 Deine Aufgaben für nächste Woche
%div{:style => "float:left, margin-bottom:2em"} %dl.dl-horizontal
%strong Deine Aufgaben für die nächste Woche: - @next_tasks.each do |task|
%table.table(style="width:25em") %dt= l task.due_date, format: "%A, %d. %b"
-for task in @next_tasks %dd= link_to task.name, task_path(task)
%tr
%td= format_date task.due_date
%td
%b= task.name
- unless @unaccepted_tasks.empty? - unless @unaccepted_tasks.empty?
%h3 Aufgaben übernehmen %h3 Aufgaben übernehmen
@ -23,7 +19,6 @@
- unless @unassigned_tasks_number == 0 - unless @unassigned_tasks_number == 0
%h3 Offene Aufgaben %h3 Offene Aufgaben
= "Es gibt #{@unassigned_tasks_number} #{link_to 'offene Aufgabe(n)', :controller => 'tasks'}".html_safe = "Es gibt #{@unassigned_tasks_number} #{link_to 'offene Aufgabe(n)', :controller => 'tasks'}".html_safe
%p= link_to "Meine Aufgaben", user_tasks_path
- if current_user.ordergroup - if current_user.ordergroup
= render :partial => 'shared/open_orders', :locals => {:ordergroup => current_user.ordergroup} = render :partial => 'shared/open_orders', :locals => {:ordergroup => current_user.ordergroup}

View file

@ -1,10 +1,9 @@
- content = wikified_body @page.body, @page.title - content = wikified_body @page.body, @page.title
- toc = generate_toc @page.body - toc = generate_toc @page.body
- unless toc.blank? - unless toc.blank? or params[:preview]
#wikitoc - content_for :sidebar do
%h2 #wikitoc.well.well-small
Inhaltsverzeichnis %h3 Inhalt
%span= link_to_function "[verstecken]", "Element.toggle('wikitoc-content')" = toc
#wikitoc-content= toc
= content = content

View file

@ -1,12 +1,26 @@
- if params[:preview] - if params[:preview]
%h2 Vorschau %section#wikiContent
#preview= render :partial => 'body' = render 'body'
#wiki-syntax-help .row-fluid
.box_title .span8
%h2 Schnelle Formatierungshilfe = simple_form_for @page do |f|
.column_content = f.hidden_field :lock_version
%table(frame="void") = f.input :title, input_html: {class: 'input-xxlarge'}
= f.input :body, input_html: {class: 'input-xxlarge'}
= f.input :parent_id, as: :select, collection: parent_pages_to_select(@page)
.form-actions
= button_tag :name => 'preview', class: 'btn' do
%i.icon-search
Vorschau
= button_tag class: 'btn' do
%i.icon-save
Speichern
= link_to "oder abbrechen", @page
.span4
%h3 Schnelle Formatierungshilfe
%table.table
%tbody %tbody
%tr %tr
%td(colspan=2) %td(colspan=2)
@ -79,17 +93,3 @@
Siehe Siehe
= link_to "Tabellen", "http://www.mediawiki.org/wiki/Help:Tables", :target => '_blank' = link_to "Tabellen", "http://www.mediawiki.org/wiki/Help:Tables", :target => '_blank'
- simple_form_for @page do |f|
= f.hidden_field :lock_version
= f.input :title
= f.input :body, :input_html => {:size => "65x30"}
%p
= submit_tag "Vorschau", :name => 'preview'
|
= submit_tag "Speichern"
|
= link_to "Abbrechen", @page
| Oberseite ändern:
= collection_select(:page, :parent_id, parent_pages_to_select(@page), :id, :permalink, {:prompt => "Neue Oberseite?", :include_blank => true})
%div(style="clear:right; height:1px")

View file

@ -1,7 +1,8 @@
.column_content %table.table.table-striped
%table %thead
%tr %tr
%th Titel %th Titel
%th Zuletzt aktualisiert %th Zuletzt aktualisiert
- for page in Page.non_redirected.order('updated_at DESC') %tbody
- for page in @pages
= render :partial => "page_list_item", :locals => {:page => page, :level => 0, :siteMap => 0} = render :partial => "page_list_item", :locals => {:page => page, :level => 0, :siteMap => 0}

View file

@ -1,11 +1,12 @@
.column_content %table.table.table-striped
%table %thead
%tr %tr
%th Titel %th Titel
%th Zuletzt aktualisiert %th Zuletzt aktualisiert
- homepage = Page.find_by_permalink('Home') - homepage = Page.find_by_permalink('Home')
- unless homepage.nil? - unless homepage.nil?
= render :partial => 'page_list_item', :locals => {:page => homepage, :level => 0, :siteMap => 1} = render :partial => 'page_list_item', :locals => {:page => homepage, :level => 0, :siteMap => 1}
- for page in Page.no_parent.non_redirected.order('created_at DESC') %tbody
- for page in @pages
- if page.id != homepage.id - if page.id != homepage.id
= render :partial => 'page_list_item', :locals => {:page => page, :level => 0, :siteMap => 1} = render :partial => 'page_list_item', :locals => {:page => page, :level => 0, :siteMap => 1}

View file

@ -1,7 +1,8 @@
.column_content %table.table.table-striped
%table %thead
%tr %tr
%th Titel %th Titel
%th Zuletzt aktualisiert %th Zuletzt aktualisiert
- for page in Page.non_redirected.order('title DESC') %tbody
- for page in @pages
= render :partial => "page_list_item", :locals => {:page => page, :level => 0, :siteMap => 0} = render :partial => "page_list_item", :locals => {:page => page, :level => 0, :siteMap => 0}

View file

@ -1,21 +1,17 @@
- title "Alle Wikiseiten", false - title "Alle Wikiseiten", false
.wiki_all - content_for :sidebar do
#breadcrump = link_to "Neue Seite anlegen", new_page_path, class: 'btn btn-primary'
= link_to_wikipage_by_permalink("Home", "Foodcoop-Wiki")
%h1 Alle Wikiseiten .navbar
.navbar-inner
%ul.nav
%li= link_to 'Letzte Änderungen', all_pages_path(:view => 'recent_changes')
%li= link_to 'Seiten-Liste', all_pages_path(:view => 'title_list')
%li= link_to 'Site Map', all_pages_path(:view => 'site_map')
= form_tag all_pages_path, method: :get, class: 'form-search pull-right' do
= text_field_tag :name, params[:name], class: 'input-medium search-query',
placeholder: 'Seitentitel ...'
= submit_tag "Suche", class: 'btn'
= render @partial
#sidebar
#sidebar-links
= link_to "Neue Seite anlegen", new_page_path
.left_column{:style => "width:100%"}
.box_title
#editOrderNav
= link_to 'Letzte Änderungen', all_pages_path(:view => 'recent_changes')
= link_to 'Seiten-Liste', all_pages_path(:view => 'title_list')
= link_to 'Site Map', all_pages_path(:view => 'site_map')
#left_column
= render :partial => params[:view] || 'recent_changes'

View file

@ -1,14 +1,3 @@
- title "#{@page.title} bearbeiten", false - title "Seite bearbeiten"
.wiki_edit = render 'form'
#breadcrump
= link_to_wikipage_by_permalink("Home", "Foodcoop-Wiki")
- for page in @page.ancestors.reverse
%span.wikiSeparator &gt;
= link_to_wikipage(page)
%span.wikiSeparator &gt;
= link_to_wikipage(@page)
%h1 #{@page.title} bearbeiten
= render :partial => 'form'

View file

@ -1,16 +1,3 @@
- title "Neue Wikiseite anlegen", false - title "Neue Wikiseite anlegen"
.wiki_new = render 'form'
#breadcrump
= link_to_wikipage_by_permalink("Home", "Foodcoop-Wiki")
- parent_page = Page.find_by_permalink(params[:parent])
- if parent_page != nil
- for page in parent_page.ancestors.reverse
%span.wikiSeparator &gt;
= link_to_wikipage(page)
%span.wikiSeparator &gt;
= @page.title
%h1 Neue Wikiseite anlegen
= render :partial => 'form'

View file

@ -1,8 +1,33 @@
- title @page.title, false - title @page.title, false
.wiki_show - content_for :sidebar do
%p
= link_to edit_page_path(@page), class: 'btn btn-primary' do
%i.icon-edit
Seite bearbeiten
.well.well-small
%ul.nav.nav-list
%li
%li= link_to "Versionen (#{@page.versions.count})", "#versions", 'data-toggle-this' => '#versions'
- unless @page.children.empty?
%li= link_to "Unterseiten", "#subpages", 'data-toggle-this' => '#subpages'
#breadcrump #versions.well.well-small{:style => "display:none"}
%h3 Versionen
%ul.unstyled
- @page.versions.reverse.each do |version|
%li
= link_to I18n.l(version.updated_at, :format => "%d.%m.%y %H:%M"), version_page_path(@page, :version => version.lock_version)
= "(#{User.find_by_id(version.updated_by).try(:nick)})"
- unless @page.children.empty?
#subpages.well.well-small{:style => "display:none"}
%h3 Unterseiten
%ul.unstyled
- @page.children.each do |page|
%li= link_to_wikipage(page)
#breadcrump
= link_to_wikipage_by_permalink("Home", "Foodcoop-Wiki") = link_to_wikipage_by_permalink("Home", "Foodcoop-Wiki")
- for page in @page.ancestors.reverse - for page in @page.ancestors.reverse
%span.wikiSeparator &gt; %span.wikiSeparator &gt;
@ -10,41 +35,19 @@
%span.wikiSeparator &gt; %span.wikiSeparator &gt;
= @page.title = @page.title
#sidebar
#sidebar-links
= link_to "Bearbeiten", edit_page_path(@page)
= link_to "Versionen (#{@page.versions.count})", "#versions", 'data-toggle-this' => '#versions'
- unless @page.children.empty?
= link_to "Unterseiten", "#subpages", 'data-toggle-this' => '#subpages'
#versions{:style => "display:none"}
.box_title
%h2 Versionen
.column_content
%ul
- for version in @page.versions.reverse
%li
= link_to I18n.l(version.updated_at, :format => "%d.%m.%y %H:%M"), version_page_path(@page, :version => version.lock_version)
= "(#{User.find_by_id(version.updated_by).try(:nick)})"
- unless @page.children.empty? #wikiContent
#subpages{:style => "display:none"} .page-header
.box_title %h1= @page.title
%h2 Unterseiten
.column_content
%ul
- for page in @page.children
%li= link_to_wikipage(page)
#wiki_content
%h1
= @page.title
= render :partial => 'body' = render :partial => 'body'
%hr.clear/ %hr.clear/
%p %p
= link_to "Seite bearbeiten", edit_page_path(@page) = link_to edit_page_path(@page), class: 'btn btn-primary' do
| %i.icon-edit
= link_to "Seite löschen", @page, :method => :delete, :confirm => "Achtung, auch alle Unterseiten werden gelöscht. Bist Du sicher?" Seite bearbeiten
= link_to "Seite löschen", @page, class: 'btn btn-danger', :method => :delete,
:confirm => "Achtung, auch alle Unterseiten werden gelöscht. Bist Du sicher?"
| Zuletzt bearbeitet von | Zuletzt bearbeitet von
%b %b
= "#{@page.user.try(:nick)}" = "#{@page.user.try(:nick)}"

View file

@ -1,27 +1,11 @@
- title @page.title, false - title "#{@page.title} - Version #{@version.lock_version}"
.wiki_version - content_for :sidebar do
#breadcrump %h3 Version
= link_to_wikipage_by_permalink("Home", "Foodcoop-Wiki")
- for page in @page.ancestors.reverse
%span.wikiSeparator &gt;
= link_to_wikipage(page)
%span.wikiSeparator &gt;
= link_to_wikipage(@page)
%h1
= @page.title
#sidebar
.box_title
%h2 Version
.column_content
%b= "#{format_datetime_timespec(@version.updated_at, "%a, %d.%m.%Y, %H:%M Uhr") }" %b= "#{format_datetime_timespec(@version.updated_at, "%a, %d.%m.%Y, %H:%M Uhr") }"
%ul %ul
%li= "Autor: #{User.find(@version.updated_by).nick}" %li= "Autor: #{User.find(@version.updated_by).nick}"
%li= link_to "Aktuelle Version sehen", wiki_page_path(:permalink => @page.permalink) %li= link_to "Aktuelle Version sehen", wiki_page_path(:permalink => @page.permalink)
%li= link_to "Auf diese Version zurücksetzen", revert_page_path(@page, :version => @version.lock_version) %li= link_to "Auf diese Version zurücksetzen", revert_page_path(@page, :version => @version.lock_version)
= wikified_body @version.body = wikified_body @version.body
%div(style="clear:right")

View file

@ -1,32 +1,25 @@
%table %dl.dl-horizontal
%tr %dt Beschreibung:
%td Beschreibung: %dd=h group.description
%td=h group.description
- if group.is_a?(Ordergroup) and (@current_user.role_admin? or @current_user.role_finance?) - if group.is_a?(Ordergroup) and (@current_user.role_admin? or @current_user.role_finance?)
%tr %dt Kontakt:
%td Kontakt: %dd=h group.contact
%td=h group.contact %dt Adresse:
%tr %dd= link_to_gmaps group.contact_address
%td Adresse: %dt Zugriff auf:
%td= link_to_gmaps group.contact_address %dd= format_roles(group)
%tr %dt Mitglieder:
%td Gruppe hat Zugriff auf: %dd
%td= format_roles(group)
%tr
%td Mitglieder:
%td
- members = group.users - members = group.users
= "(#{members.size})" = "(#{members.size})"
= members.collect(&:nick).join(", ") = members.collect(&:nick).join(", ")
- if group.is_a?(Workgroup) - if group.is_a?(Workgroup)
%tr %dt wöchentlicher Job:
%td wöchentlicher Job: %dd
%td
- if group.weekly_task - if group.weekly_task
=h "#{group.task_name} am #{weekday(group.weekday)}" =h "#{group.task_name} am #{weekday(group.weekday)}"
- else - else
kein wöchentlicher Job definiert kein wöchentlicher Job definiert
- else - else
%tr %dt Äpfel-Bestellbeschränkung
%td Äpfel-Bestellbeschränkung %dd= group.ignore_apple_restriction ? 'deaktiviert' : 'aktiviert'
%td= group.ignore_apple_restriction ? 'deaktiviert' : 'aktiviert'

View file

@ -1,5 +1,5 @@
= f.input :name = f.input :name
= f.input :description = f.input :description, as: :text, input_html: {rows: 4}
= yield = yield
@ -11,19 +11,20 @@
= f.input :task_name = f.input :task_name
= f.input :task_required_users = f.input :task_required_users
= f.input :task_duration, :as => :select, :collection => (1..3) = f.input :task_duration, :as => :select, :collection => (1..3)
= f.input :task_description, as: :text, input_html: {rows: 10} = f.input :task_description, as: :text, input_html: {rows: 5}
= f.input :next_weekly_tasks_number = f.input :next_weekly_tasks_number
= f.input :user_tokens, :as => :string, :input_html => { 'data-pre' => f.object.users.map { |u| u.token_attributes }.to_json } = f.input :user_tokens, :as => :string,
:input_html => { 'data-pre' => f.object.users.map { |u| u.token_attributes }.to_json }
- content_for :head do - content_for :javascript do
:javascript :javascript
function toggleWeeklyTaskFields() { function toggleWeeklyTaskFields() {
if ($('#workgroup_weekly_task').is(':checked')) { if ($('#workgroup_weekly_task').is(':checked')) {
$('#weekly_task_fields div.input').show(); $('#weekly_task_fields .control-group').show();
$('#weekly_task_fields input').removeAttr('disabled'); $('#weekly_task_fields input').removeAttr('disabled');
} else { } else {
$('#weekly_task_fields div.input').hide(); $('#weekly_task_fields .control-group').hide();
$('#weekly_task_fields input').attr('disabled', 'disabled'); $('#weekly_task_fields input').attr('disabled', 'disabled');
} }
} }
@ -39,7 +40,8 @@
prePopulate: $("##{f.object.class.to_s.underscore}_user_tokens").data("pre"), prePopulate: $("##{f.object.class.to_s.underscore}_user_tokens").data("pre"),
hintText: 'Nach Nutzerin suchen', hintText: 'Nach Nutzerin suchen',
noResultText: 'Keine Nutzerin gefunden', noResultText: 'Keine Nutzerin gefunden',
searchingText: 'Suche ...' searchingText: 'Suche ...',
theme: 'facebook'
}); });
}); });

View file

@ -335,6 +335,7 @@ de:
private: Privat private: Privat
page: page:
body: 'Inhalt' body: 'Inhalt'
parent_id: Oberseite
supplier: supplier:
address: 'Adresse' address: 'Adresse'
phone: 'Telefon' phone: 'Telefon'