#369: updated UI of wiki

This commit is contained in:
Vokhmin Alexey V 2014-11-19 02:31:10 +03:00
parent d1116e70db
commit 77798af6f1
14 changed files with 159 additions and 136 deletions

View File

@ -1,41 +0,0 @@
= form_tag compare_path(@project, @name), name: "compare-versions", id: "version-form" do
%table.wiki{cellpadding: "0", cellspacing: "0"}
- @versions.each do |v|
%tr.history
%td.td1
%span#niceCheckbox1.niceCheck-main{onclick: "changeCheck(this)"}
/ = check_box_tag "versions[]", v.id, html: {class: 'history_cbx'}
%input{type: 'checkbox', id: 'versions_', name: 'versions[]', value: v.id, class: 'history_cbx'}
%td.td2
- user = User.where(email: v.author.email).first
.avatar
= link_to user_path_by_user(user) do
= image_tag avatar_url_by_email(v.author.email), alt: "avatar: #{v.author.name}", class: 'mini-gravatar'
.name
= link_to user_path_by_user(user) do
%span.username= user.present? ? user.fullname : v.author.name
.both
%td.td3
= datetime_moment v.committed_date, tag: :span, class: 'wiki-gray'
= v.message
- if @name
= raw "[#{link_to v.id[0..6], versioned_project_wiki_path(@project, escaped_name, v.id), title: t("wiki.view_commit")}]"
- else
= "[#{v.id[0..6]}]"
:javascript
$('.niceCheck-main').click(function() {
var count = 0;
$('input.history_cbx').each(function(i,el) {
if ($(el).attr('checked')) {
count = count + 1;
}
});
if (count > 2) {
var cbx = $( $(this).find('input.history_cbx')[0] );
if ( cbx.attr('checked') ) {
$(this).css('background-position', '0pt 0px');
cbx.removeAttr('checked');
}
}
});

View File

@ -0,0 +1,37 @@
= form_tag compare_path(@project, @name), name: "compare-versions", id: "version-form" do
table.table
- @versions.each do |v|
tr
td
/ span#niceCheckbox1.niceCheck-main onclick="changeCheck(this)"
/ = check_box_tag "versions[]", v.id, html: {class: 'history_cbx'}
input type='checkbox' id='versions_' name='versions[]' value=v.id class='history_cbx'
td
- user = User.where(email: v.author.email).first
=> link_to user_path_by_user(user) do
= image_tag avatar_url_by_email(v.author.email), alt: "avatar: #{v.author.name}", class: 'mini-gravatar'
span
= link_to user_path_by_user(user) do
span.username
= user.present? ? user.fullname : v.author.name
td
= datetime_moment v.committed_date, tag: :span, class: 'wiki-gray'
= v.message
- if @name
= raw "[#{link_to v.id[0..6], versioned_project_wiki_path(@project, escaped_name, v.id), title: t("wiki.view_commit")}]"
- else
= "[#{v.id[0..6]}]"
/ - content_for :javascript do
/ coffee:
/ $('.niceCheck-main').click ->
/ count = 0
/ $('input.history_cbx').each (i,el) ->
/ if $(el).is(':checked')
/ count = count + 1
/ if count > 2
/ cbx = $( $(this).find('input.history_cbx')[0] )
/ if cbx.is(':checked')
/ $(this).css('background-position', '0pt 0px')
/ cbx.removeAttr('checked')

View File

@ -1,19 +0,0 @@
#wiki-content
.wrap{class: "#{has_footer? ? 'has-footer' : ''} #{has_sidebar? ? 'has-rightbar' : ''}"}
#wiki-body{class: "gollum-#{format}-content"}
#template= raw @content
- if has_sidebar?
#wiki-rightbar{class: "gollum-#{sidebar_format}-content"}= raw sidebar_content
- if has_footer?
#wiki-footer{class: "gollum-#{footer_format}-content"}
#footer-content= raw footer_content
.both
#gollum-footer
%p#last-edit
= t("wiki.last_edited_by")
%b= user_link_by_user User.where(email: author_email).first
= datetime_moment date, tag: :span
- unless action_name == 'preview' or cannot? :write, @project
%p#delete-link
= link_to project_wiki_path(@project, escaped_name), method: :delete, data: { confirm: t("layout.confirm") } do
%span= t("wiki.delete_page")

View File

@ -0,0 +1,23 @@
#wiki-content
/ .wrap{class: "#{has_footer? ? 'has-footer' : ''} #{has_sidebar? ? 'has-rightbar' : ''}"}
.wrap
#wiki-body class="gollum-#{format}-content"
#template= raw @content
- if has_sidebar?
#wiki-rightbar class="gollum-#{sidebar_format}-content"}
= raw sidebar_content
- if has_footer?
#wiki-footer class="gollum-#{footer_format}-content"
#footer-content
= raw footer_content
.both
hr
.help-block
=> t("wiki.last_edited_by")
b>
= user_link_by_user User.where(email: author_email).first
= datetime_moment date, tag: :span
- unless action_name == 'preview' or cannot? :write, @project
a.btn.btn-danger href=project_wiki_path(@project, escaped_name) data-method='delete' data-confirm=t('layout.confirm')
= t("wiki.delete_page")

View File

@ -1,14 +0,0 @@
- act = action_name.intern
%aside
.admin-preferences
%ul
%li{class: ((act == :show and @name == 'Home') or act == :index) ? 'active' : ''}
= link_to t("wiki.home"), project_wiki_index_path(@project)
%li{class: (act == :pages) ? 'active' : ''}
= link_to t("wiki.pages"), pages_project_wiki_index_path(@project)
%li{class: (act == :wiki_history or act == :compare_wiki) ? 'active' : ''}
= link_to t("wiki.wiki_history"), history_project_wiki_index_path(@project)
%li{class: (act == :git) ? 'active' : ''}
= link_to t("wiki.git_access"), git_project_wiki_index_path(@project)
%br
= render 'searchbar'

View File

@ -0,0 +1,34 @@
- act = action_name.intern
/ %aside
/ .admin-preferences
/ %ul
/ %li{class: ((act == :show and @name == 'Home') or act == :index) ? 'active' : ''}
/ = link_to t("wiki.home"), project_wiki_index_path(@project)
/ %li{class: (act == :pages) ? 'active' : ''}
/ = link_to t("wiki.pages"), pages_project_wiki_index_path(@project)
/ %li{class: (act == :wiki_history or act == :compare_wiki) ? 'active' : ''}
/ = link_to t("wiki.wiki_history"), history_project_wiki_index_path(@project)
/ %li{class: (act == :git) ? 'active' : ''}
/ = link_to t("wiki.git_access"), git_project_wiki_index_path(@project)
/ %br
/ = render 'searchbar'
.panel.panel-default
.panel-body
ul.nav.nav-pills.nav-stacked
li class=('active' if (act == :show && @name == 'Home') || act == :index)
a href=project_wiki_index_path(@project)
= t('wiki.home')
li class=('active' if act == :pages)
a href=pages_project_wiki_index_path(@project)
= t('wiki.pages')
li class=('active' if act == :wiki_history || act == :compare_wiki)
a href=history_project_wiki_index_path(@project)
= t('wiki.wiki_history')
li class=('active' if act == :git)
a href=git_project_wiki_index_path(@project)
= t('wiki.git_access')

View File

@ -1,15 +0,0 @@
-set_meta_tags title: [title_object(@project), t('wiki.git_access')]
/ = render 'gollum_includes'
/ = render 'project_short'
= render 'submenu'
.desription-top
.img= image_tag("code.png")
= render "git_access"
.both
= render "git_access_message"
.both
- content_for :sidebar do
- render 'sidebar'

View File

@ -0,0 +1,25 @@
-set_meta_tags title: [title_object(@project), t('wiki.git_access')]
/ = render 'gollum_includes'
/ = render 'project_short'
== render 'submenu'
.row
.col-md-2.col-md-offset-1
== render 'sidebar'
.col-md-8
nav.navbar.navbar-default
.collapse.navbar-collapse
.navbar-text.navbar-left
a.navbar-link
i.fa.fa-code-fork.fa-lg
form.navbar-form.navbar-left
.form-group
input.form-control type='text' value=git_repo_url(@project.wiki_repo_name) readonly=true
.navbar-text.navbar-left
a.navbar-link
i.fa.fa-clipboard.fa-lg
.navbar-text.navbar-left
= can?(:write, @project) ? t("layout.read_write_access") : t("layout.read_access")
== render 'git_access_message'

View File

@ -1,11 +0,0 @@
-set_meta_tags title: [title_object(@project), t('wiki.wiki_history')]
= render 'submenu'
.r= link_to t("wiki.compare_revisions"), "javascript:void(0);", class: "action-compare-revision button width100"
.both
= render 'history'
.both
- content_for :sidebar do
- render 'sidebar'

View File

@ -0,0 +1,11 @@
-set_meta_tags title: [title_object(@project), t('wiki.wiki_history')]
== render 'submenu'
.row
.col-md-2.col-md-offset-1
== render 'sidebar'
.col-md-8
= link_to t("wiki.compare_revisions"), "javascript:void(0);", class: "action-compare-revision button width100"
== render 'history'

View File

@ -1,11 +0,0 @@
-set_meta_tags title: [title_object(@project), t('wiki.pages')]
= render 'submenu'
- if can? :write, @project
.r= link_to t("wiki.new_page"), '#', :'data-url' => project_wiki_index_path(@project), id: 'minibutton-new-page', class: 'button width100'
.both
= render "results"
- content_for :sidebar do
- render 'sidebar'

View File

@ -0,0 +1,14 @@
- set_meta_tags title: [title_object(@project), t('wiki.pages')]
== render 'submenu'
.row
.col-md-2.col-md-offset-1
== render 'sidebar'
.col-md-8
- if can? :write, @project
a.btn.btn-primary href=project_wiki_index_path(@project)
= t("wiki.new_page")
hr
== render "results"

View File

@ -1,25 +0,0 @@
-set_meta_tags title: [title_object(@project), @page.name]
= render 'submenu'
.left
%h3
= @page.name
= "(#{t("wiki.preview")})" if action_name == 'preview'
- unless action_name == 'preview'
.r
= link_to t("wiki.page_history"), history_project_wiki_path(@project, escaped_name), class: 'button'
.r
- if @editable
= link_to t("wiki.edit_page"), edit_project_wiki_path(@project, escaped_name), class: 'button'
.r
- if can? :write, @project
= link_to t("wiki.new_page"), '#', :'data-url' => project_wiki_index_path(@project), id: 'minibutton-new-page', class: 'button'
.both
/ = render 'searchbar'
= render "page"
- content_for :sidebar do
- render 'sidebar'
:css
#wiki-content .wrap { width: 100% }

View File

@ -0,0 +1,15 @@
- set_meta_tags title: [title_object(@project), @page.name]
== render 'submenu'
.row
.col-md-2.col-md-offset-1
== render 'sidebar'
.col-md-8
h3
= @page.name
= "(#{ t("wiki.preview") })" if action_name == 'preview'
- unless action_name == 'preview'
.row
== render 'page'