]> git.mxchange.org Git - friendica.git/commitdiff
add field select templates
authorrabuzarus <>
Mon, 25 Apr 2016 22:36:40 +0000 (00:36 +0200)
committerrabuzarus <>
Mon, 25 Apr 2016 22:36:40 +0000 (00:36 +0200)
js/theme.js
templates/field_custom.tpl [new file with mode: 0644]
templates/field_select.tpl [new file with mode: 0644]
templates/field_select_raw.tpl [new file with mode: 0644]
templates/field_themeselect.tpl [new file with mode: 0644]

index 690c7741864d3ae6ce1b4dbe62e2def560d6e7e8..b81c94cf3c3893c62dc6af9684d75a4490413773 100644 (file)
@@ -40,6 +40,7 @@ $(document).ready(function(){
        }
 
        // give select fields an boostrap classes
+       // @todo: this needs to be changed in friendica core
        $(".field.select, .field.custom").addClass("form-group");
        $(".field.select > select, .field.custom > select").addClass("form-control");
 
diff --git a/templates/field_custom.tpl b/templates/field_custom.tpl
new file mode 100644 (file)
index 0000000..20f5292
--- /dev/null
@@ -0,0 +1,6 @@
+
+<div class="form-group field custom">
+       <label for="{{$field.0}}">{{$field.1}}</label>
+       {{$field.2}}
+       <span class="help-block" id="{{$field.0}}_tip">{{$field.3}}</span>
+</div>
diff --git a/templates/field_select.tpl b/templates/field_select.tpl
new file mode 100644 (file)
index 0000000..9c03151
--- /dev/null
@@ -0,0 +1,8 @@
+
+<div class="form-group field select">
+               <label for="id_{{$field.0}}">{{$field.1}}</label>
+               <select name="{{$field.0}}" id="id_{{$field.0}}" class="form-control" aria-describedby="{{$field.0}}_tip">
+                       {{foreach $field.4 as $opt=>$val}}<option value="{{$opt|escape:'html'}}" {{if $opt==$field.2}}selected="selected"{{/if}}>{{$val}}</option>{{/foreach}}
+               </select>
+               <span class="help-block" id="{{$field.0}}_tip">{{$field.3}}</span>
+</div>
\ No newline at end of file
diff --git a/templates/field_select_raw.tpl b/templates/field_select_raw.tpl
new file mode 100644 (file)
index 0000000..d4f4768
--- /dev/null
@@ -0,0 +1,8 @@
+
+<div class="form-group field select">
+       <label for="id_{{$field.0}}">{{$field.1}}</label>
+       <select class="form-control" name="{{$field.0}}" id="id_{{$field.0}}" aria-describedby="{{$field.0}}_tip">
+               {{$field.4}}
+       </select>
+       <span class="help-block" id="{{$field.0}}_tip">{{$field.3}}</span>
+</div>
\ No newline at end of file
diff --git a/templates/field_themeselect.tpl b/templates/field_themeselect.tpl
new file mode 100644 (file)
index 0000000..04f4e82
--- /dev/null
@@ -0,0 +1,10 @@
+
+{{if $field.5=="preview"}}<script>$(document).ready(function(){ previewTheme($("#id_{{$field.0}}")[0]); });</script>{{/if}}
+<div class="form-group field select">
+       <label for="id_{{$field.0}}">{{$field.1}}</label>
+       <select class="form-control" name="{{$field.0}}" id="id_{{$field.0}}" {{if $field.5=="preview"}}onchange="previewTheme(this);"{{/if}} aria-describedby="{{$field.0}}_tip" >
+               {{foreach $field.4 as $opt=>$val}}<option value="{{$opt}}" {{if $opt==$field.2}}selected="selected"{{/if}}>{{$val}}</option>{{/foreach}}
+       </select>
+       <span class="help-block" id="{{$field.0}}_tip">{{$field.3}}</span>
+       {{if $field.5=="preview"}}<div id="theme-preview"></div>{{/if}}
+</div>
\ No newline at end of file