From 77798af6f1f372c7a89137f012bd25188a0f5b91 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Wed, 19 Nov 2014 02:31:10 +0300 Subject: [PATCH] #369: updated UI of wiki --- app/views/projects/wiki/_history.html.haml | 41 ---------------------- app/views/projects/wiki/_history.html.slim | 37 +++++++++++++++++++ app/views/projects/wiki/_page.html.haml | 19 ---------- app/views/projects/wiki/_page.html.slim | 23 ++++++++++++ app/views/projects/wiki/_sidebar.html.haml | 14 -------- app/views/projects/wiki/_sidebar.html.slim | 34 ++++++++++++++++++ app/views/projects/wiki/git.html.haml | 15 -------- app/views/projects/wiki/git.html.slim | 25 +++++++++++++ app/views/projects/wiki/history.html.haml | 11 ------ app/views/projects/wiki/history.html.slim | 11 ++++++ app/views/projects/wiki/pages.html.haml | 11 ------ app/views/projects/wiki/pages.html.slim | 14 ++++++++ app/views/projects/wiki/show.html.haml | 25 ------------- app/views/projects/wiki/show.html.slim | 15 ++++++++ 14 files changed, 159 insertions(+), 136 deletions(-) delete mode 100644 app/views/projects/wiki/_history.html.haml create mode 100644 app/views/projects/wiki/_history.html.slim delete mode 100644 app/views/projects/wiki/_page.html.haml create mode 100644 app/views/projects/wiki/_page.html.slim delete mode 100644 app/views/projects/wiki/_sidebar.html.haml create mode 100644 app/views/projects/wiki/_sidebar.html.slim delete mode 100644 app/views/projects/wiki/git.html.haml create mode 100644 app/views/projects/wiki/git.html.slim delete mode 100644 app/views/projects/wiki/history.html.haml create mode 100644 app/views/projects/wiki/history.html.slim delete mode 100644 app/views/projects/wiki/pages.html.haml create mode 100644 app/views/projects/wiki/pages.html.slim delete mode 100644 app/views/projects/wiki/show.html.haml create mode 100644 app/views/projects/wiki/show.html.slim diff --git a/app/views/projects/wiki/_history.html.haml b/app/views/projects/wiki/_history.html.haml deleted file mode 100644 index e518bfd96..000000000 --- a/app/views/projects/wiki/_history.html.haml +++ /dev/null @@ -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'); - } - } - }); \ No newline at end of file diff --git a/app/views/projects/wiki/_history.html.slim b/app/views/projects/wiki/_history.html.slim new file mode 100644 index 000000000..23602bbcd --- /dev/null +++ b/app/views/projects/wiki/_history.html.slim @@ -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') diff --git a/app/views/projects/wiki/_page.html.haml b/app/views/projects/wiki/_page.html.haml deleted file mode 100644 index f8a6efd76..000000000 --- a/app/views/projects/wiki/_page.html.haml +++ /dev/null @@ -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") \ No newline at end of file diff --git a/app/views/projects/wiki/_page.html.slim b/app/views/projects/wiki/_page.html.slim new file mode 100644 index 000000000..98b2c6a5a --- /dev/null +++ b/app/views/projects/wiki/_page.html.slim @@ -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") \ No newline at end of file diff --git a/app/views/projects/wiki/_sidebar.html.haml b/app/views/projects/wiki/_sidebar.html.haml deleted file mode 100644 index 9284e635f..000000000 --- a/app/views/projects/wiki/_sidebar.html.haml +++ /dev/null @@ -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' \ No newline at end of file diff --git a/app/views/projects/wiki/_sidebar.html.slim b/app/views/projects/wiki/_sidebar.html.slim new file mode 100644 index 000000000..6680e1f2e --- /dev/null +++ b/app/views/projects/wiki/_sidebar.html.slim @@ -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') diff --git a/app/views/projects/wiki/git.html.haml b/app/views/projects/wiki/git.html.haml deleted file mode 100644 index 00e90f2c3..000000000 --- a/app/views/projects/wiki/git.html.haml +++ /dev/null @@ -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' diff --git a/app/views/projects/wiki/git.html.slim b/app/views/projects/wiki/git.html.slim new file mode 100644 index 000000000..d9bffa056 --- /dev/null +++ b/app/views/projects/wiki/git.html.slim @@ -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' diff --git a/app/views/projects/wiki/history.html.haml b/app/views/projects/wiki/history.html.haml deleted file mode 100644 index 45416fd58..000000000 --- a/app/views/projects/wiki/history.html.haml +++ /dev/null @@ -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' diff --git a/app/views/projects/wiki/history.html.slim b/app/views/projects/wiki/history.html.slim new file mode 100644 index 000000000..fb6e4d17b --- /dev/null +++ b/app/views/projects/wiki/history.html.slim @@ -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' + diff --git a/app/views/projects/wiki/pages.html.haml b/app/views/projects/wiki/pages.html.haml deleted file mode 100644 index c9a34910c..000000000 --- a/app/views/projects/wiki/pages.html.haml +++ /dev/null @@ -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' diff --git a/app/views/projects/wiki/pages.html.slim b/app/views/projects/wiki/pages.html.slim new file mode 100644 index 000000000..d02ea419f --- /dev/null +++ b/app/views/projects/wiki/pages.html.slim @@ -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" diff --git a/app/views/projects/wiki/show.html.haml b/app/views/projects/wiki/show.html.haml deleted file mode 100644 index 8ace7e971..000000000 --- a/app/views/projects/wiki/show.html.haml +++ /dev/null @@ -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% } diff --git a/app/views/projects/wiki/show.html.slim b/app/views/projects/wiki/show.html.slim new file mode 100644 index 000000000..522c541a3 --- /dev/null +++ b/app/views/projects/wiki/show.html.slim @@ -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'