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";
// 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
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
def version

View File

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

View File

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

View File

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

View File

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

View File

@ -1,12 +1,26 @@
- if params[:preview]
%h2 Vorschau
#preview= render :partial => 'body'
%section#wikiContent
= render 'body'
#wiki-syntax-help
.box_title
%h2 Schnelle Formatierungshilfe
.column_content
%table(frame="void")
.row-fluid
.span8
= simple_form_for @page do |f|
= f.hidden_field :lock_version
= 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
%tr
%td(colspan=2)
@ -79,17 +93,3 @@
Siehe
= 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.table-striped
%thead
%tr
%th Titel
%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}

View File

@ -1,11 +1,12 @@
.column_content
%table
%table.table.table-striped
%thead
%tr
%th Titel
%th Zuletzt aktualisiert
- homepage = Page.find_by_permalink('Home')
- unless homepage.nil?
= 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
= render :partial => 'page_list_item', :locals => {:page => page, :level => 0, :siteMap => 1}

View File

@ -1,7 +1,8 @@
.column_content
%table
%table.table.table-striped
%thead
%tr
%th Titel
%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}

View File

@ -1,21 +1,17 @@
- title "Alle Wikiseiten", false
.wiki_all
#breadcrump
= link_to_wikipage_by_permalink("Home", "Foodcoop-Wiki")
- content_for :sidebar do
= link_to "Neue Seite anlegen", new_page_path, class: 'btn btn-primary'
%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'
#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'
= render @partial

View File

@ -1,14 +1,3 @@
- title "#{@page.title} bearbeiten", false
- title "Seite bearbeiten"
.wiki_edit
#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'
= render 'form'

View File

@ -1,16 +1,3 @@
- title "Neue Wikiseite anlegen", false
- title "Neue Wikiseite anlegen"
.wiki_new
#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'
= render 'form'

View File

@ -1,51 +1,54 @@
- title @page.title, false
.wiki_show
#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;
= @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?
#subpages{:style => "display:none"}
.box_title
%h2 Unterseiten
.column_content
%ul
- for page in @page.children
%li= link_to_wikipage(page)
#wiki_content
%h1
= @page.title
= render :partial => 'body'
%hr.clear/
- content_for :sidebar do
%p
= link_to "Seite bearbeiten", edit_page_path(@page)
|
= link_to "Seite löschen", @page, :method => :delete, :confirm => "Achtung, auch alle Unterseiten werden gelöscht. Bist Du sicher?"
| Zuletzt bearbeitet von
%b
= "#{@page.user.try(:nick)}"
= "am #{format_datetime @page.updated_at}"
= 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'
#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")
- for page in @page.ancestors.reverse
%span.wikiSeparator &gt;
= link_to_wikipage(page)
%span.wikiSeparator &gt;
= @page.title
#wikiContent
.page-header
%h1= @page.title
= render :partial => 'body'
%hr.clear/
%p
= link_to edit_page_path(@page), class: 'btn btn-primary' do
%i.icon-edit
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
%b
= "#{@page.user.try(:nick)}"
= "am #{format_datetime @page.updated_at}"

View File

@ -1,27 +1,11 @@
- title @page.title, false
- title "#{@page.title} - Version #{@version.lock_version}"
.wiki_version
#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
#sidebar
.box_title
%h2 Version
.column_content
%b= "#{format_datetime_timespec(@version.updated_at, "%a, %d.%m.%Y, %H:%M Uhr") }"
%ul
%li= "Autor: #{User.find(@version.updated_by).nick}"
%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)
= wikified_body @version.body
%div(style="clear:right")
- content_for :sidebar do
%h3 Version
%b= "#{format_datetime_timespec(@version.updated_at, "%a, %d.%m.%Y, %H:%M Uhr") }"
%ul
%li= "Autor: #{User.find(@version.updated_by).nick}"
%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)
= wikified_body @version.body

View File

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

View File

@ -1,5 +1,5 @@
= f.input :name
= f.input :description
= f.input :description, as: :text, input_html: {rows: 4}
= yield
@ -11,19 +11,20 @@
= f.input :task_name
= f.input :task_required_users
= 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 :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
function toggleWeeklyTaskFields() {
if ($('#workgroup_weekly_task').is(':checked')) {
$('#weekly_task_fields div.input').show();
$('#weekly_task_fields .control-group').show();
$('#weekly_task_fields input').removeAttr('disabled');
} else {
$('#weekly_task_fields div.input').hide();
$('#weekly_task_fields .control-group').hide();
$('#weekly_task_fields input').attr('disabled', 'disabled');
}
}
@ -39,7 +40,8 @@
prePopulate: $("##{f.object.class.to_s.underscore}_user_tokens").data("pre"),
hintText: 'Nach Nutzerin suchen',
noResultText: 'Keine Nutzerin gefunden',
searchingText: 'Suche ...'
searchingText: 'Suche ...',
theme: 'facebook'
});
});

View File

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