Skip to content

Commit

Permalink
re #77 added autogenerated code for a form to customize the 'brand' p…
Browse files Browse the repository at this point in the history
…art of the wiki in the layout
  • Loading branch information
allan-simon committed Aug 13, 2013
1 parent 13c5834 commit 2cd049b
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 0 deletions.
18 changes: 18 additions & 0 deletions app/src/contents/Admin.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include "cppcms_skel/contents/content.h"

#include "contents/forms/change_brand.h"
//%%%NEXT_CONTENT_FORM_INCLUDE_MARKER%%%

namespace contents {
Expand All @@ -28,6 +29,23 @@ namespace admin {
struct Admin : public BaseContent {
};

/**
* @struct ChangeBrand
* @since 14 August 2013
* @brief
*/
struct ChangeBrand : public Admin {

forms::admin::ChangeBrand changeBrandForm;

/**
* @brief Constructor
*/
ChangeBrand() {
}

};

//%%%NEXT_CONTENT_MARKER%%%

} // end of namespace admin
Expand Down
60 changes: 60 additions & 0 deletions app/src/contents/forms/change_brand.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/**
* Tatoeba wiki Wiki made with cppcmsskel
*
* Copyright (C) 2013 Allan SIMON <[email protected]>
* See accompanying file COPYING.TXT file for licensing details.
*
* @category Tatoeba wiki
* @package Form
* @author Allan SIMON <[email protected]>
* @link https://github.com/allan-simon/tatowiki
*/

#ifndef TATOWIKI_CHANGE_BRAND
#define TATOWIKI_CHANGE_BRAND


#include <cppcms/form.h>

namespace forms{
namespace admin {

/**
* @struct change_brand TODO description
* @since 14 August 2013
*
*/
struct ChangeBrand : public cppcms::form {

//%%%NEXT_WIDGET_VAR_MARKER%%%

/**
* @brief button to submit the form
*/
cppcms::widgets::submit submit;

/**
* @brief Constructor
*/
ChangeBrand() {

//%%%NEXT_WIDGET_ADD_MARKER%%%

add(submit);
submit.name(
cppcms::locale::translate("submit")
);
submit.value("submit");
}


};


} // end of namespace admin
}// end of namespace forms


#endif


32 changes: 32 additions & 0 deletions app/src/controllers/webs/Admin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ Admin::Admin(cppcms::service& serv) :
controllers::webs::Controller(serv)
{


dispatcher().assign("/change-brand", &Admin::change_brand, this);
dispatcher().assign("/change-brand_treat", &Admin::change_brand_treat, this);
//%%%NEXT_ACTION_DISPATCHER_MARKER%%%, do not delete


//%%%NEXT_NEW_MODEL_CTRL_MARKER%%%
}

Expand All @@ -38,6 +42,34 @@ Admin::~Admin() {
//%%%NEXT_DEL_MODEL_CTRL_MARKER%%%
}

/**
*
*/
void Admin::change_brand() {

contents::admin::ChangeBrand c;
init_content(c);


render("admin_change_brand", c);
}


/**
*
*/
void Admin::change_brand_treat() {

forms::admin::ChangeBrand form;
form.load(context());

if (!form.validate()) {
go_back_to_previous_page();
}

}


// %%%NEXT_ACTION_MARKER%%% , do not delete


Expand Down
12 changes: 12 additions & 0 deletions app/src/controllers/webs/Admin.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ class Admin : public Controller {
private:
// %%%NEXT_VAR_MODEL_CTRL_MARKER%%%

/**
* @brief @TODO add a description
* @since 14 August 2013
*/
void change_brand();

/**
* @brief @TODO add a description
* @since 14 August 2013
*/
void change_brand_treat();

// %%%NEXT_ACTION_MARKER%%% , do not delete

};
Expand Down
14 changes: 14 additions & 0 deletions app/src/views/webs/commons/admin/change_brand.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<% c++ #include "contents/Admin.h" %>
<% skin %>
<% view common_admin_change_brand uses contents::admin::ChangeBrand extends master %>
<% template title() %><% gt "TODO TITLE" %><% end template %>


<% template body() %>
Edit Me Admin / ChangeBrand
<% end template %>



<% end view %>
<% end skin %>
6 changes: 6 additions & 0 deletions app/src/views/webs/responsive/admin/change_brand.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<% c++ #include "contents/Admin.h" %>
<% skin %>
<% view admin_change_brand uses contents::admin::ChangeBrand extends common_admin_change_brand %>

<% end view %>
<% end skin %>
7 changes: 7 additions & 0 deletions app/src/views/webs/tatoeba/admin/change_brand.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<% c++ #include "contents/Admin.h" %>
<% skin %>
<% view admin_change_brand uses contents::admin::ChangeBrand extends common_admin_change_brand %>

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

0 comments on commit 2cd049b

Please sign in to comment.