Browse Source

bandeau_region via config.xml

master
pvincent 2 years ago
parent
commit
f2c6c05a00
  1. 90
      lang/master/tpl/design.mtt
  2. 52
      package.json
  3. 2
      src/App.hx
  4. 51
      src/form/ColorRadioGroup.hx
  5. 42
      src/sugoi/BaseView.hx
  6. 2
      src/sugoi/Config.hx
  7. BIN
      www/img/bandeau_region.png

90
lang/master/tpl/design.mtt

@ -1,5 +1,5 @@
::use 'base.mtt'::
::if getParam('__redirect')!=null::
<!-- need to login to go to this page-->
<script>$(function(){
@ -16,11 +16,11 @@
<h1>::_("Cagette.net")::</h1>
::end::
</div>
<div class="col-md-4 accountBlock">
::if user != null::
<div class="col-md-4 accountBlock">
::if user != null::
<div class="dropdown pull-right text-right userName" style="margin-top:16px;">
<a class="" style="margin-right:16px;" href="/user/choose?show=1">
<span class="glyphicon glyphicon-chevron-left"></span>::_("Change group")::
</a>
@ -29,46 +29,46 @@
<span class="glyphicon glyphicon-user"></span>
::user.getName()::
::if user.firstName2!=null::
::_("et"):: ::user.lastName2:: ::user.firstName2::
::_("et"):: ::user.lastName2:: ::user.firstName2::
::end::
</a>
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenu1">
<li><a href="/user/logout"><span class="glyphicon glyphicon-log-out"></span> ::_("Log out")::</a></li>
</ul>
</div>
</div>
::else::
<div class="pull-right text-right">
<a href="/user/login" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-user"></span> ::_("Log in")::</a>
<a class="btn btn-default btn-sm" href="/group/map"><span class="glyphicon glyphicon-search"></span> ::_("Look for another group")::</a>
<a class="btn btn-default btn-sm" href="/group/map"><span class="glyphicon glyphicon-search"></span> ::_("Look for another group")::</a>
</div>
::end::
</div>
</div>
</div>
::if user != null && noGroup!=true::
<nav class="navbar navbar-default" ::cond user.getAmap()!=null::>
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#cagette-navbar">
<span class="sr-only">Toggle navigation</span>
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
</button>
</div>
<div class="collapse navbar-collapse" id="cagette-navbar">
<ul class="nav navbar-nav navbar-left">
<li ::attr class if(category=="home") 'active' ::><a href="/">::_("Home")::</a></li>
<li ::attr class if(category=="contract" ) 'active' ::><a href="/contract">::_("My account")::</a></li>
<li ::attr class if(category=="amap") 'active' ::><a href="/amap">::_("Farmers")::</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li id="member" ::attr class if(category=="members") 'active' ::>
<a href="/member" ::cond user.canAccessMembership()::>::_("Members")::</a></li>
@ -81,13 +81,13 @@
<li ::cond user.isAdmin():: ::attr class if(category=="admin") 'active' ::>
<a href="/admin" >::_("Admin")::</a></li>
</ul>
</div>
</nav>
::end::
<!-- Notifications -->
<div class="row">
<div id="content" class="col-md-12">
@ -98,22 +98,22 @@
::else::
<span class="glyphicon glyphicon-ok"></span>
::end::
::raw notification.text::
::raw notification.text::
</div>
::end::
</div>
</div>
</div>
<!-- extra notification block for plugins -->
::if extraNotifBlock!=null::
::raw extraNotifBlock::
::end::
<div class="row">
::raw __content__::
</div>
</div>
<!--<div class="row">
<div class="col-md-12 alert-danger text-center" style="border-radius: 8px;margin:8px 0;padding:8px 0;">
<span class="glyphicon glyphicon-cog"></span>
@ -124,7 +124,7 @@
</div>-->
<div class="row" id="footer">
<div class="col-md-2" >
<img width="120" style="border: white 5px solid;" src="/img/logo-mini.jpg" alt="::_("Cagette.net")::" title="Logo ::_("Cagette.net")::"/>
</div>
@ -133,12 +133,12 @@
Cagette Péi est un logiciel libre qui favorise les circuits courts.<br/>
Il a été adapté pour les besoins des AMAPs sur le marché réunionnais.<br/>
</div>
<div class="col-md-3" >
::_("HELP")::
<ul>
<li>
<a href="http://www.cagette.net/wiki" target="_blank">::_("Documentation")::</a>
<li>
<a href="http://www.cagette.net/wiki" target="_blank">::_("Documentation")::</a>
</li>
<li>
<a href="https://pad1.zourit.net/p/4a3b09afd25b4fdcb3f0a9598db21e61" target="_blank">Proposer une amélioration</a>
@ -146,18 +146,24 @@
<li>
<a href="https://pad1.zourit.net/p/4a3b09afd25b4fdcb3f0a9598db21e61" target="_blank">Soumettre une anomalie</a>
</li>
</ul>
</ul>
</div>
</div>
<div class="row" id="subfooter">
<span>version cagettepei-<a target="_blank" href="https://git.artcode.re/cagetters/cagettepei/src/tag/::VERSION::">::VERSION::</a></span>
<p>
version cagettepei-<a target="_blank" href="https://git.artcode.re/cagetters/cagettepei/src/tag/::VERSION::">::VERSION::</a>
</p>
::if BANDEAU_REGION::
<img src='/img/bandeau_region.png' alt='bandeau Région Réunion' width='250'></img>
::end::
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-12">
<!-- SQL LOG -->
<table class="sqlLog table table-bordered" ::cond sqlLog::>
::foreach r sqlLog::
@ -172,5 +178,5 @@
</table>
</div>
</div>
::end::

52
package.json

@ -1 +1,51 @@
{"name": "cagette-pei", "description": "le logiciel libre du circuit court", "license": "AGPL-3.0", "dependencies": {"bootstrap": "^3.3.4", "eonasdan-bootstrap-datetimepicker": "^4.7.14", "geolib": "^2.0.24", "haxe-modular": "^0.7.0", "jquery": "^2.2.4", "leaflet": "^1.3.1", "react": "^15.6.1", "react-bootstrap-typeahead": "1.4.2", "react-datetime": "^2.9.0", "react-dom": "^15.6.1", "react-leaflet": "^1.8.0", "react-places-autocomplete": "^6.0.2", "react-router": "^4.2.0", "react-router-dom": "^4.2.2"}, "devDependencies": {"babel-preset-es2015": "^6.24.1", "babel-preset-react": "^6.24.1", "babelify": "^7.3.0", "browserify": "^14.4.0", "cross-env": "^5.1.1", "node-sass": "^4.5.3", "npm-run-all": "^4.1.2", "uglify-js": "^3.1.9", "watchify": "^3.9.0"}, "scripts": {"build": "npm-run-all --parallel build:*", "build:js": "haxe cagetteJs.hxml", "build:sass": "node-sass www/css -o www/css", "watch:sass": "npm run build:sass -- --watch", "build2": "babel src -d lib", "libs:dev": "browserify js/libs/libs.js -o www/js/libs.js -d", "libs:prod": "cross-env NODE_ENV=production browserify js/libs/libs.js | uglifyjs -c -m > www/js/libs.js", "test": "haxe testsJS.hxml && node js/test/tests.js", "prepush": "npm test"}, "repository": {"type": "git", "url": "git+https://github.com/bablukid/cagette.git"}, "bugs": {"url": "https://github.com/bablukid/cagette/issues"}, "version": "1.11.9"}
{
"name": "cagette-pei",
"description": "le logiciel libre du circuit court",
"license": "AGPL-3.0",
"dependencies": {
"bootstrap": "^3.3.4",
"eonasdan-bootstrap-datetimepicker": "^4.7.14",
"geolib": "^2.0.24",
"haxe-modular": "^0.7.0",
"jquery": "^2.2.4",
"leaflet": "^1.3.1",
"react": "^15.6.1",
"react-bootstrap-typeahead": "1.4.2",
"react-datetime": "^2.9.0",
"react-dom": "^15.6.1",
"react-leaflet": "^1.8.0",
"react-places-autocomplete": "^6.0.2",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2"
},
"devDependencies": {
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babelify": "^7.3.0",
"browserify": "^14.4.0",
"cross-env": "^5.1.1",
"node-sass": "^4.5.3",
"npm-run-all": "^4.1.2",
"uglify-js": "^3.1.9",
"watchify": "^3.9.0"
},
"scripts": {
"build": "npm-run-all --parallel build:*",
"build:js": "haxe cagetteJs.hxml",
"build:sass": "node-sass www/css -o www/css",
"watch:sass": "npm run build:sass -- --watch",
"build2": "babel src -d lib",
"libs:dev": "browserify js/libs/libs.js -o www/js/libs.js -d",
"libs:prod": "cross-env NODE_ENV=production browserify js/libs/libs.js | uglifyjs -c -m > www/js/libs.js",
"test": "haxe testsJS.hxml && node js/test/tests.js",
"prepush": "npm test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/bablukid/cagette.git"
},
"bugs": {
"url": "https://github.com/bablukid/cagette/issues"
},
"version": "1.11.9"
}

2
src/App.hx

@ -203,7 +203,7 @@ class App extends sugoi.BaseApp {
out.set("percent", "Pourcentage");
out.set("pinned", "Mets en avant les produits");
out.set("CagetteNetwork", "Me lister dans l'annuaire des groupes Cagette.net");
out.set("CagetteNetwork", "Me lister dans l'annuaire");
out.set("unitType", "Unité");
out.set("qt", "Quantité");
out.set("Unit", "Pièce");

51
src/form/ColorRadioGroup.hx

@ -1,46 +1,39 @@
package form;
import sugoi.form.elements.RadioGroup;
import Common;
class ColorRadioGroup extends RadioGroup
{
public function new(name:String, label:String,selected:String)
{
class ColorRadioGroup extends RadioGroup {
public function new(name:String, label:String, selected:String) {
var data = [];
var i = 0;
for (c in db.CategoryGroup.COLORS) {
data.push( { value:Std.string(c), label:Std.string(i) } );
data.push({value: Std.string(c), label: Std.string(i)});
i++;
}
super(name, label, data, selected, "1", false, true);
}
override public function render():String
{
override public function render():String {
var s = "";
var n = parentForm.name + "_" +name;
var n = parentForm.name + "_" + name;
var c = 0;
if (data != null)
{
for (row in data)
{
var radio = "<input type=\"radio\" name=\""+n+"\" id=\""+n+c+"\" value=\"" + row.label + "\" " + (row.label == Std.string(value) ? "checked":"") +" />\n";
var img = "<div style='margin-right:16px;width:32px;height:32px;background:"+App.current.view.intToHex(Std.parseInt(row.value))+";'></div>";
s += "<label for=\"" + n+c + "\" class='checkbox' style='display: inline-block;'>"+radio + " "+img+" </label>";
if (data != null) {
for (row in data) {
var radio = "<input type=\"radio\" name=\"" + n + "\" id=\"" + n + c + "\" value=\"" + row.label + "\" "
+ (row.label == Std.string(value) ? "checked" : "") + " />\n";
var img = "<div style='margin-right:16px;width:32px;height:32px;background:"
+ App.current.view.intToHex(Std.parseInt(row.value))
+ ";'></div>";
s += "<label for=\"" + n + c + "\" class='checkbox' style='display: inline-block;'>" + radio + " " + img + " </label>";
c++;
}
}
}
return s;
}
}
}

42
src/sugoi/BaseView.hx

@ -13,26 +13,28 @@ class BaseView implements Dynamic {
public function init() {
var app = App.current;
this.user = app.user;
this.session = app.session;
this.LANG = App.config.LANG;
this.HOST = App.config.HOST;
this.DATA_HOST = App.config.DATA_HOST;
this.DEBUG = App.config.DEBUG;
this.BANDEAU_REGION = App.config.BANDEAU_REGION;
this.NAME = App.config.NAME;
this.isAdmin = app.user != null && app.user.isAdmin();
//Access basic functions in views
this.Std = Std;
this.Math = Math;
if ( App.config.SQL_LOG ) {
this.Config = App.config;
if ( App.config.SQL_LOG ) {
this.sqlLog = untyped app.cnx == null ? null : app.cnx.log;
}
}
function getMessage() {
var session = App.current.session;
if ( session == null ) return null;
@ -41,14 +43,14 @@ class BaseView implements Dynamic {
if( n == null ) return null;
return { text : n.text, error : n.error, next : session.messages.length > 0 };
}
function getMessages() {
var out = [];
var session = App.current.session;
if ( session == null ) return [];
if (session.messages == null) return [];
for ( m in session.messages) {
if( m == null ) continue;
out.push( { text : m.text, error : m.error } );
@ -56,12 +58,12 @@ class BaseView implements Dynamic {
session.messages = [];
return out;
}
function urlEncode(str:String) {
return StringTools.urlEncode(str);
}
/**
* To safely print a string in javascript
* @param str
@ -70,13 +72,13 @@ class BaseView implements Dynamic {
if (str == null) return "";
return str.split("\\").join("\\\\").split("'").join("\\'").split("\r").join("\\r").split("\n").join("\\n");
}
/**
* Get a value from the Variable table
* @param file
*/
function getVariable( file : String ) {
var v = _vcache.get(file);
if( v != null )
return v;
@ -91,7 +93,7 @@ class BaseView implements Dynamic {
function getParam( p : String ) {
return App.current.params.get(p);
}
/**
* Return the url of a db.File record
*/
@ -99,7 +101,7 @@ class BaseView implements Dynamic {
if (file == null) throw "file is null";
return "/file/"+sugoi.db.File.makeSign(file.id)+"."+file.getExtension();
}
/**
* Try to print an HTML table from any kind of object
* @param data
@ -107,14 +109,14 @@ class BaseView implements Dynamic {
function table(data:Dynamic) {
return new sugoi.helper.Table("table table-bordered").toString(data);
}
/**
* newline to <br/>
* @param txt
*/
public function nl2br(txt:String):String {
public function nl2br(txt:String):String {
if (txt == null) return "";
return txt.split("\n").join("<br/>");
return txt.split("\n").join("<br/>");
}
@ -125,7 +127,7 @@ class BaseView implements Dynamic {
return str;
}
}
//same function with params ( templo doesnt manage optionnal params in functions )
public function __(str:String, params:Dynamic){
return sugoi.i18n.Locale.texts.get(str, params);
@ -136,7 +138,7 @@ class BaseView implements Dynamic {
neko.Web.logMessage("_call "+str);
return StringTools.rtrim( str.split("||")[0] );
}
//same function with params ( templo doesnt manage optionnal params in functions )
public function __(str:String, params:Dynamic):String {
neko.Web.logMessage("_call "+str);
@ -159,5 +161,5 @@ class BaseView implements Dynamic {
}
return list;
}
}

2
src/sugoi/Config.hx

@ -11,6 +11,7 @@ class Config {
public var TPL:String;
public var TPL_TMP:String;
public var DEBUG:Bool;
public var BANDEAU_REGION:Bool;
public var HOST:String;
public var NAME:String;
public var KEY:String;
@ -28,6 +29,7 @@ class Config {
TPL = PATH + "lang/" + LANG + "/tpl/";
TPL_TMP = PATH + "lang/" + LANG + "/tmp/";
DEBUG = get("debug", "0") == "1";
BANDEAU_REGION = get("bandeau_region", "0") == "1";
HOST = get("host");
KEY = get("key");
DATA_HOST = get("dataHost", "data." + HOST);

BIN
www/img/bandeau_region.png

After

Width: 1081  |  Height: 526  |  Size: 153 KiB

Loading…
Cancel
Save