diff --git a/app/src/contents/Admin.h b/app/src/contents/Admin.h index 62e635d..e48d33c 100644 --- a/app/src/contents/Admin.h +++ b/app/src/contents/Admin.h @@ -15,6 +15,7 @@ #include "cppcms_skel/contents/content.h" +#include "contents/forms/change_brand.h" //%%%NEXT_CONTENT_FORM_INCLUDE_MARKER%%% namespace contents { @@ -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 diff --git a/app/src/contents/forms/change_brand.h b/app/src/contents/forms/change_brand.h new file mode 100644 index 0000000..5a7ecdc --- /dev/null +++ b/app/src/contents/forms/change_brand.h @@ -0,0 +1,60 @@ +/** + * Tatoeba wiki Wiki made with cppcmsskel + * + * Copyright (C) 2013 Allan SIMON + * See accompanying file COPYING.TXT file for licensing details. + * + * @category Tatoeba wiki + * @package Form + * @author Allan SIMON + * @link https://github.com/allan-simon/tatowiki + */ + +#ifndef TATOWIKI_CHANGE_BRAND +#define TATOWIKI_CHANGE_BRAND + + +#include + +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 + + diff --git a/app/src/controllers/webs/Admin.cpp b/app/src/controllers/webs/Admin.cpp index e4fef15..5a8d175 100644 --- a/app/src/controllers/webs/Admin.cpp +++ b/app/src/controllers/webs/Admin.cpp @@ -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%%% } @@ -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 diff --git a/app/src/controllers/webs/Admin.h b/app/src/controllers/webs/Admin.h index 81d85a8..987bf24 100644 --- a/app/src/controllers/webs/Admin.h +++ b/app/src/controllers/webs/Admin.h @@ -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 }; diff --git a/app/src/views/webs/commons/admin/change_brand.tmpl b/app/src/views/webs/commons/admin/change_brand.tmpl new file mode 100644 index 0000000..9c408f1 --- /dev/null +++ b/app/src/views/webs/commons/admin/change_brand.tmpl @@ -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 %> diff --git a/app/src/views/webs/responsive/admin/change_brand.tmpl b/app/src/views/webs/responsive/admin/change_brand.tmpl new file mode 100644 index 0000000..ad1e5a2 --- /dev/null +++ b/app/src/views/webs/responsive/admin/change_brand.tmpl @@ -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 %> diff --git a/app/src/views/webs/tatoeba/admin/change_brand.tmpl b/app/src/views/webs/tatoeba/admin/change_brand.tmpl new file mode 100644 index 0000000..bcc0b33 --- /dev/null +++ b/app/src/views/webs/tatoeba/admin/change_brand.tmpl @@ -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 %> +