Skip to content

Commit

Permalink
re #76 refactored all the articles/ pages , still need to update the …
Browse files Browse the repository at this point in the history
…javascript part of tatoeba skins
  • Loading branch information
allan-simon committed Jul 5, 2013
1 parent d51feb0 commit f75cd91
Show file tree
Hide file tree
Showing 22 changed files with 356 additions and 629 deletions.
5 changes: 4 additions & 1 deletion app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.6)
project(tatowiki)

# set the version
set(PROJECT_VERSION "0.20.2")
set(PROJECT_VERSION "0.20.3")
set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${PROJECT_VERSION})
add_custom_target(
dist
Expand Down Expand Up @@ -105,6 +105,7 @@ set(
set(
WEB_SKINS_COMMONS
${WEB_SKINS_COMMONS_DIR}/layouts/master.tmpl
${WEB_SKINS_COMMONS_DIR}/layouts/article_edition.tmpl
${WEB_SKINS_COMMONS_DIR}/*/*.tmpl
)

Expand All @@ -124,6 +125,7 @@ add_custom_command(
COMMAND cppcms_tmpl_cc
${WEB_SKINS_COMMONS_DIR}/layouts/master.tmpl
${TATOEBA_WEB_SKIN_DIR}/layouts/master.tmpl
${WEB_SKINS_COMMONS_DIR}/layouts/article_edition.tmpl
${TATOEBA_WEB_SKIN_DIR}/layouts/article_edition.tmpl
${WEB_SKINS_COMMONS_DIR}/*/*.tmpl
${TATOEBA_WEB_SKIN_DIR}/*/*.tmpl
Expand All @@ -147,6 +149,7 @@ add_custom_command(
COMMAND cppcms_tmpl_cc
${WEB_SKINS_COMMONS_DIR}/layouts/master.tmpl
${RESPONSIVE_WEB_SKIN_DIR}/layouts/master.tmpl
${WEB_SKINS_COMMONS_DIR}/layouts/article_edition.tmpl
${RESPONSIVE_WEB_SKIN_DIR}/layouts/article_edition.tmpl
${WEB_SKINS_COMMONS_DIR}/*/*.tmpl
${RESPONSIVE_WEB_SKIN_DIR}/*/*.tmpl
Expand Down
38 changes: 38 additions & 0 deletions app/src/views/webs/commons/articles/create.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<% c++ #include "contents/Articles.h" %>
<% skin %>
<% view common_articles_create uses contents::articles::Create extends article_edition %>
<% template title() %><% gt "Create a new article" %><% end template %>

<% template css() %>
<% include css_link("articles/create.css") %>
<% end template %>


<% template main_content() %>
<% include begin_module() %>
<h2><% gt "Create a new article" %></h2>
<form method="POST" action="/articles/create_treat" >
<% form input createForm.slug %>
<table>
<% include title_area(createForm) %>
<% include editor_area(createForm) %>
<% include summary_text(createForm) %>
</table>
<% include save_buttons(createForm) %>
</form>
<% include end_module() %>
<% include preview_module() %>
<% end template %>

/**
*
*/
<% template annexe_content() %>
<% include markdown_help() %>
<% end template %>



<% end view %>
<% end skin %>

33 changes: 33 additions & 0 deletions app/src/views/webs/commons/articles/edit.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<% c++ #include "contents/Articles.h" %>
<% skin %>
<% view common_articles_edit uses contents::articles::Edit extends article_edition %>
<% template title() %><% gt "Edit article" %><% end template %>


<% template local_css() %>
<% include css_link("articles/create.css") %>
<% end template %>



<% template main_content() %>
<% include begin_module() %>
<h2><% gt "Edit article" %></h2>
<form method="POST" action="/articles/edit_treat" >
<% form input editForm.slug %>
<% form input editForm.lastVersion %>
<table>
<% include title_area(editForm) %>
<% include editor_area(editForm) %>
<% include summary_text(editForm) %>
</table>
<% include save_buttons(editForm) %>
</form>
<% include end_module() %>
<% include preview_module() %>
<% end template %>


<% end view %>
<% end skin %>

78 changes: 78 additions & 0 deletions app/src/views/webs/commons/articles/show.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<% c++ #include <cppcms_skel/generics/Languages.h> %>
<% c++ #include "contents/Articles.h" %>
<% skin %>
<% view common_articles_show uses contents::articles::Show extends master %>
<% template title() %><%= article.title %><% end template %>


<% template main_content() %>
<% cache cacheKey %>
<% include begin_module() %>
<%= article.content | ext markdown %>
<% include end_module() %>
<%end cache %>
<% end template %>

<% template annexe_content() %>
<% include begin_module() %>
<h2><%gt "Actions" %></h2>

<ul class="annexeMenu">
<li>
<a href="/articles/edit/<%= article.slug | urlencode %>">
<%gt "Edit" %>
</a>
</li>
<li>
<a href="/articles/translate/<%= article.slug | urlencode %>">
<%gt "Translate" %>
</a>
</li>
<li>
<a href="/history/all-versions-of/<%= article.slug | urlencode %>">
<%gt "History" %>
</a>
</li>
<li>
<a href="/articles/remove/<%= article.slug | urlencode %>">
<%gt "Remove" %>
</a>
</li>
</ul>
<% include end_module() %>
<% include begin_module() %>
<h2><%gt "Article available in:" %></h2>

<% foreach translation in translatedIn %>
<ul>
<% item %>
<li>
<% include link_to_translation(translation.first, translation.second) %>
</li>
<% end %>
</ul>
<% end foreach %>
<% include end_module() %>
<% end template %>

/**
*
* @brief Generate the html link to an article, giving its lang and slug
*
* @param lang The code of the language in which the article is written
* @param slug The slug of that article
*
* @since 28 December 2012
*/
<% template link_to_translation(std::string lang, std::string slug) %>
<a
href="<% include article_url(lang,slug) %>"
>
<% c++ out() << Languages::get_instance()->get_interface_lang_from_code(lang); %>
</a>
<% end template %>



<% end view %>
<% end skin %>
43 changes: 43 additions & 0 deletions app/src/views/webs/commons/articles/show_all.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<% c++ #include "contents/Articles.h" %>
<% c++ #include "generics/Config.h" %>
<% skin %>
<% view common_articles_show_all uses contents::articles::ShowAll extends master %>
<% template title() %><% gt "All articles" %><% end template %>


<% template main_content() %>
<% include begin_module() %>
<h1><% gt "All articles" %></h1>
<% foreach article in articles %>
<ul>
<% item %>
<li>
<%= article.lang %>:
<a href="<% include article_url(article.lang,article.slug) %>">
<%= article.title %>
</a>
( <%= article.slug %> )
</li>
<% end %>
</ul>
<% end foreach %>
<% include end_module() %>
<% end template %>

<% template annexe_content() %>
<% include begin_module() %>
<h2><%gt "Actions" %></h2>

<ul class="annexeMenu">
<li>
<!-- TODO replace by application root !-->
<a href="/">
<%gt "Go back to main page" %>
</a>
</li>
</ul>
<% include end_module() %>
<% end template %>

<% end view %>
<% end skin %>
23 changes: 23 additions & 0 deletions app/src/views/webs/commons/articles/show_conflict.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<% c++ #include "contents/Articles.h" %>
<% skin %>
<% view common_articles_show_conflict uses contents::articles::ShowConflict extends master %>
<% template title() %><% gt "Show conflict" %><% end template %>

<% template main_content() %>
<% include begin_module() %>
<h1><% gt "Notice" %></h1>
<% gt "You're seeing this page because someone has saved a modified version while you were edidting." %>
<% gt "In order to prevent conflicts, your version has been saved there." %>
<% gt "Note that for the moment unfortunately we don't provide tools to resolve it automatically, so you may need to transpose your changes manually." %>
<% include end_module() %>
<% include begin_module() %>
<%= article.content | ext markdown %>
<% include end_module() %>
<% end template %>





<% end view %>
<% end skin %>
38 changes: 38 additions & 0 deletions app/src/views/webs/commons/articles/translate.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<% c++ #include "contents/Articles.h" %>
<% skin %>
<% view common_articles_translate uses contents::articles::Translate extends article_edition %>
<% template title() %><% gt "Translate article" %><% end template %>

<% template local_css() %>
<% include css_link("articles/create.css") %>
<% end template %>

<% template main_content() %>
<% include begin_module() %>
<h2><% gt "Translate article" %></h2>
<form
id="translateform"
method="POST"
action="/articles/translate_treat"
>
<% form input translateForm.slug %>
<table>
<% include title_area(translateForm) %>
<% include widget_row(translateForm.transLang) %>
<% include slug_text(translateForm) %>
<% include editor_area(translateForm) %>
<% include summary_text(translateForm) %>
</table>
<% include save_buttons(translateForm) %>
</form>
<% include end_module() %>
<% include preview_module() %>
<% end template %>

<% template slug_text(forms::articles::Translate & form) %>
<% include widget_row_text(form.translationSlug, "<span>http://.../articles/show/</span>") %>
<% end template %>

<% end view %>
<% end skin %>

83 changes: 83 additions & 0 deletions app/src/views/webs/commons/layouts/article_edition.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<% c++ #ifndef SKIN_COMMONS_LAYOUT_ARTICLE_EDITION %>
<% c++ #define SKIN_COMMONS_LAYOUT_ARTICLE_EDITION %>
<% c++ #include "contents/Articles.h" %>
<% skin %>
/**
* @brief Common template used by all the page related to
* article edition
*/

<% view common_article_edition uses contents::BaseContent extends master %>

<% template group_css() %>
<% include css_link("external/jquery-ui.css") %>
<% include css_link("external/jquery.markedit.css") %>
<% end template %>


<% template footer_js() %>
<% include js_link("external/showdown.js") %>
<% include js_link("external/jquery.min.js") %>
<% include js_link("external/jquery-ui.js") %>
<% include js_link("external/jquery.form.js") %>
<% include js_link("external/jquery.markedit.js") %>
<% include js_link("mardown_editor.js") %>
<% end template %>

<% template title_area(forms::articles::BaseArticleForm & form) %>
<% include widget_row(form.title) %>
<% end template %>

<% template summary_text(forms::articles::BaseArticleForm & form) %>
<% include widget_row(form.summary) %>
<% end template %>



<% template editor_area(forms::articles::BaseArticleForm & form) %>
<%include widget_row_text(form.content, "<div id='editor-button-bar'></div>") %>
<% end template %>

<% template save_buttons(forms::articles::BaseArticleForm & form) %>
<div class="submit">

<% form input form.saveAndView %>
</div>
<div class="submit">
<% form input form.saveAndContinue %>
</div>
<% end template %>

<% template preview_module() %>
<% include begin_module() %>
<h2><% gt "Preview" %></h2>
<div id="editor-preview"></div>
<% include end_module() %>
<% end template %>
/**
*
*/
<% template annexe_content() %>
<% include begin_module() %>
<h2><%gt "Actions" %></h2>

<ul class="annexeMenu">
<li>
<a href="upload-image">
<%gt "Upload a new image" %>
</a>
</li>
<li>
<a href="list-all">
<%gt "View all images" %>
</a>
</li>

</ul>
<% include end_module() %>
<% include markdown_help() %>
<% end template %>

<% end view %>
<% end skin %>
<% c++ #endif %>
Loading

0 comments on commit f75cd91

Please sign in to comment.