Skip to content

Commit

Permalink
re #76 factorized history/ pages
Browse files Browse the repository at this point in the history
  • Loading branch information
allan-simon committed Jul 5, 2013
1 parent f75cd91 commit 24e7b72
Show file tree
Hide file tree
Showing 19 changed files with 294 additions and 503 deletions.
2 changes: 1 addition & 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.3")
set(PROJECT_VERSION "0.20.4")
set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${PROJECT_VERSION})
add_custom_target(
dist
Expand Down
61 changes: 61 additions & 0 deletions app/src/views/webs/commons/history/all_versions_of.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<% c++ #include "contents/History.h" %>
<% skin %>
<% view common_history_all_versions_of uses contents::history::AllVersionsOf extends master %>
<% template title() %><% gt "Article's history" %><% end template %>


<% template main_content() %>
<% include begin_module() %>
<% foreach change in changes %>
<ul>
<% item %>
<li>
<% gt "version {1}: " using change.version %>


<% if (change.nextVersion != -1) %>
<a href="/history/show-version/<%= change.version %>">
<% gt "Show that version" %>
</a>
<% else %>
<% gt "Current version" %>
<% end %>

<% if (change.previousVersion != -1) %>
<a href="<% include diff_url(articleId,change.previousVersion,change.version) %>" >
<% gt "Show diff with previous version" %>
</a>
<% else %>
<% gt "First version" %>
<% end %>
<% gt "<span class='time'>{1,dt=s}</span>" using change.editTime %>
<% gt "by {1}" using change.byUserName %>
<br/>
<% gt "summary: " %>
<span class="summary"><%= change.summary %></span>
</li>
<% end %>
</ul>
<% end foreach %>
<% include end_module () %>
<% end template %>


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

<ul class="annexeMenu">
<li>
<a href="/articles/show/<%= slug | urlencode %>">
<%gt "Go back to article's page" %>
</a>
</li>
</ul>
<% include end_module () %>
<% end template %>



<% end view %>
<% end skin %>
18 changes: 18 additions & 0 deletions app/src/views/webs/commons/history/diff_between.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<% c++ #include "contents/History.h" %>
<% skin %>
<% view common_history_diff_between uses contents::history::DiffBetween extends master %>
<% template title() %><% gt "TODO TITLE" %><% end template %>


<% template body() %>
Edit Me History / DiffBetween
<form method="POST" action="<% url "/history/diff-between_treat" %>" >
<% form as_p diffBetweenForm %>
</form>
<% end template %>



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

61 changes: 61 additions & 0 deletions app/src/views/webs/commons/history/recent_changes.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<% c++ #include "contents/History.h" %>
<% skin %>
<% view common_history_recent_changes uses contents::history::RecentChanges extends master %>
<% template title() %><% gt "Recent changes" %><% end template %>

/**
*
*/
<% template history_of_url( std::string const& slug) %>/history/all-versions-of/<%= slug %><% end template %>


/**
*
*/
<% template diff_with_previous_of_url( int const& articleId, int const& version) %>/history/diff-with-previous-version-of/<%= articleId %>/<%= version %><% end template %>




<% template main_content() %>
<% include begin_module() %>
<h2><% gt "Recent changes" %></h2>

<% foreach version in articlesVersions %>
<ul>
<% item %>
<li>
(
<a href="<% include diff_with_previous_of_url(version.article.id,version.change.version) %>">
<% gt "diff" %>
</a>
|
<a href="<% include history_of_url(version.article.slug) %>">
<% gt "history " %>
</a>
) ..
<% gt "<span class='time'>{1,dt=s}</span>" using version.change.editTime %>
<a href="<% include article_url(version.article.lang,version.article.slug) %>">
<%= version.article.title %>
</a>
<% gt "by {1}" using version.change.byUserName %>
<!-- TODO use < url %> instead -->
<br/>
<% gt "summary: " %>
<span class="summary"><%= version.change.summary %></span>
</li>
<% end %>
</ul>
<% end foreach %>
<% include end_module () %>
<% end template %>

/**
* @brief TODO maybe put some texts there
*/
<% template annexe_content() %>
<% end template %>


<% end view %>
<% end skin %>
14 changes: 14 additions & 0 deletions app/src/views/webs/commons/history/revert_to_version.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<% c++ #include "contents/History.h" %>
<% skin %>
<% view common_history_revert_to_version uses contents::history::RevertToVersion extends master %>
<% template title() %><% gt "TODO TITLE" %><% end template %>


<% template body() %>
Edit Me History / RevertToVersion
<% end template %>



<% end view %>
<% end skin %>
74 changes: 74 additions & 0 deletions app/src/views/webs/commons/history/show_diff_between.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<% c++ #include "contents/History.h" %>
<% skin %>
<% view common_history_show_diff_between uses contents::history::ShowDiffBetween extends master %>
<% template title() %><% gt "Difference between version {1} and {2} " using oldVersion, newVersion %><% end template %>

/**
*
*/
<% template main_content() %>
<% include begin_module() %>
<div id="showDiff"></div>
<h2 id="nameOld" ><% gt "Version at: {1,dt=s}" using diff.oldVersionTime %></h2>
<pre id="old"><%= diff.oldContent %></pre>
<h2 id="nameNew" ><% gt "version at: {1,dt=s}" using diff.newVersionTime %></h2>
<pre id="new"><%= diff.newContent %></pre>
<% include end_module () %>
<% end template %>


<% template annexe_content() %>
<% include begin_module() %>
<h2><% gt "Note" %></h2>
<p>
<% gt "The lines in green are the lines that have been added in the new version." %>
<% gt "The lines in red are those that have been removed." %>
</p>
<% include end_module () %>
<% include begin_module() %>
<h2><%gt "Actions" %></h2>

<ul class="annexeMenu">
<li>
<a
href="/history/all-versions-of/<%= slug | urlencode %>"
>
<%gt "History" %>
</a>
</li>
<li>
<a
href="/history/revert-to-version/<%= slug | urlencode %>/<%= oldVersion %>"
>
<%gt "Revert to version made the <span class='time'>{1,dt=s}</span>" using diff.oldVersionTime %>
</a>
</li>
<li>
<a href="/articles/show/<%= slug | urlencode %>">
<%gt "Go back to article's page" %>
</a>
</li>

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

/**
*
*/
<% template local_css() %>
<%include css_link("external/diffview.css") %>
<% end template %>

/**
*
*/
<% template footer_js() %>
<% include js_link("external/difflib.js") %>
<% include js_link("external/diffview.js") %>
<% include js_link("diffpage.js") %>
<% end template %>


<% end view %>
<% end skin %>
53 changes: 53 additions & 0 deletions app/src/views/webs/commons/history/show_version.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<% c++ #include "contents/History.h" %>
<% skin %>
<% view common_history_show_version uses contents::history::ShowVersion extends master %>
//TODO
<% template title() %><% gt "Previous version" %><% end template %>

<% template main_content() %>
<% include begin_module() %>
<h1><% gt "Notice" %></h1>
<% gt "This page show a previous version of the article" %>
<% include end_module () %>

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


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

<ul class="annexeMenu">
<li>
<a
href="/history/all-versions-of/<%= articleVersion.article.slug | urlencode %>"
>
<%gt "History" %>
</a>
</li>
<li>
<a
href="/history/revert-to-version/<%= articleVersion.article.slug | urlencode %>/<%= articleVersion.change.version %>"
>
<%gt "Revert" %>
</a>
</li>
<li>
<a href="/articles/show/<%= articleVersion.article.slug | urlencode %>">
<%gt "Go back to article's page" %>
</a>
</li>

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





<% end view %>
<% end skin %>
57 changes: 1 addition & 56 deletions app/src/views/webs/responsive/history/all_versions_of.tmpl
Original file line number Diff line number Diff line change
@@ -1,61 +1,6 @@
<% c++ #include "contents/History.h" %>
<% skin %>
<% view history_all_versions_of uses contents::history::AllVersionsOf extends master %>
<% template title() %><% gt "Article's history" %><% end template %>


<% template main_content() %>
<% include begin_module() %>
<% foreach change in changes %>
<ul>
<% item %>
<li>
<% gt "version {1}: " using change.version %>


<% if (change.nextVersion != -1) %>
<a href="/history/show-version/<%= change.version %>">
<% gt "Show that version" %>
</a>
<% else %>
<% gt "Current version" %>
<% end %>

<% if (change.previousVersion != -1) %>
<a href="<% include diff_url(articleId,change.previousVersion,change.version) %>" >
<% gt "Show diff with previous version" %>
</a>
<% else %>
<% gt "First version" %>
<% end %>
<% gt "<span class='time'>{1,dt=s}</span>" using change.editTime %>
<% gt "by {1}" using change.byUserName %>
<br/>
<% gt "summary: " %>
<span class="summary"><%= change.summary %></span>
</li>
<% end %>
</ul>
<% end foreach %>
<% include end_module () %>
<% end template %>


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

<ul class="annexeMenu">
<li>
<a href="/articles/show/<%= slug | urlencode %>">
<%gt "Go back to article's page" %>
</a>
</li>
</ul>
<% include end_module () %>
<% end template %>


<% view history_all_versions_of uses contents::history::AllVersionsOf extends common_history_all_versions_of %>

<% end view %>
<% end skin %>
13 changes: 1 addition & 12 deletions app/src/views/webs/responsive/history/diff_between.tmpl
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
<% c++ #include "contents/History.h" %>
<% skin %>
<% view history_diff_between uses contents::history::DiffBetween extends master %>
<% template title() %><% gt "TODO TITLE" %><% end template %>


<% template body() %>
Edit Me History / DiffBetween
<form method="POST" action="<% url "/history/diff-between_treat" %>" >
<% form as_p diffBetweenForm %>
</form>
<% end template %>


<% view history_diff_between uses contents::history::DiffBetween extends common_history_diff_between %>

<% end view %>
<% end skin %>
Expand Down
Loading

0 comments on commit 24e7b72

Please sign in to comment.