Repository: roller
Updated Branches:
  refs/heads/bootstrap-ui 840f46c63 -> 5889e03e9


Remove unecessary usage of Angular in Create Weblog page.


Project: http://git-wip-us.apache.org/repos/asf/roller/repo
Commit: http://git-wip-us.apache.org/repos/asf/roller/commit/5889e03e
Tree: http://git-wip-us.apache.org/repos/asf/roller/tree/5889e03e
Diff: http://git-wip-us.apache.org/repos/asf/roller/diff/5889e03e

Branch: refs/heads/bootstrap-ui
Commit: 5889e03e9705942f59b02a4c553aa13fb8003f10
Parents: 840f46c
Author: Dave Johnson <[email protected]>
Authored: Sun Aug 19 17:05:22 2018 -0400
Committer: Dave Johnson <[email protected]>
Committed: Sun Aug 19 17:05:22 2018 -0400

----------------------------------------------------------------------
 .../resources/ApplicationResources.properties   |  2 +-
 .../webapp/WEB-INF/jsps/core/CreateWeblog.jsp   | 45 +++++++++-----------
 2 files changed, 22 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/roller/blob/5889e03e/app/src/main/resources/ApplicationResources.properties
----------------------------------------------------------------------
diff --git a/app/src/main/resources/ApplicationResources.properties 
b/app/src/main/resources/ApplicationResources.properties
index ce46a24..8a8b4e9 100644
--- a/app/src/main/resources/ApplicationResources.properties
+++ b/app/src/main/resources/ApplicationResources.properties
@@ -1322,7 +1322,7 @@ themeEditor.previewDescription=Before you update your 
theme you can use <b>Previ
 themeEditor.importWarning=WARNING: Updating your custom theme <b>will 
overwrite</b> \
   some of your existing templates.
 themeEditor.importRequired=Since this is the first time using a  custom theme, 
\
-  Roller will copy the templates from your existing theme so you can edit them.
+  Roller will copy the templates from your existing Shared Theme so you can 
edit them.
 themeEditor.importAndOverwriteTemplates=Import the Shared Theme selected above 
and overwrite existing custom theme.
 themeEditor.existingTemplatesWarning=<b>This blog already has a custom theme 
defined so you need to make a choice</b>. \
   Do you want to switch back to using that theme, or do you want to over write 
that theme with the \

http://git-wip-us.apache.org/repos/asf/roller/blob/5889e03e/app/src/main/webapp/WEB-INF/jsps/core/CreateWeblog.jsp
----------------------------------------------------------------------
diff --git a/app/src/main/webapp/WEB-INF/jsps/core/CreateWeblog.jsp 
b/app/src/main/webapp/WEB-INF/jsps/core/CreateWeblog.jsp
index 9b862a5..b5e973f 100644
--- a/app/src/main/webapp/WEB-INF/jsps/core/CreateWeblog.jsp
+++ b/app/src/main/webapp/WEB-INF/jsps/core/CreateWeblog.jsp
@@ -62,14 +62,10 @@
     <div class="form-group" ng-app="themeSelectModule" 
ng-controller="themeController">
         <label class="col-sm-3 control-label" 
for="createWeblog_bean_timeZone">Timezone</label>
         <div class="col-sm-9 controls">
-            <select id="themeSelector" name="bean.theme" size="1"
-                    ng-model="selectedTheme"
-                    ng-options="theme as theme.name for theme in themes track 
by theme.id">
-            </select>
-            <br>
-            <br>
-            <p>{{ selectedTheme.description }}</p>
-            <img src="<s:property value='siteURL'/>{{ 
selectedTheme.previewPath }}"/>
+            <s:select name="bean.theme" size="1" list="themes" listKey="id" 
listValue="name"
+                      onchange="previewImage(this[selectedIndex].value)"/>
+            <p id="themedescription"></p>
+            <img id="themeThumbnail" src='' />
         </div>
     </div>
 
@@ -85,23 +81,18 @@
 
     document.forms[0].elements[0].focus();
 
-    angular.module('themeSelectModule', [])
-        .controller('themeController', ['$scope', function ($scope) {
-            $.ajax({
-                url: "<s:property value='siteURL' 
/>/roller-ui/authoring/themedata", async: false,
-                success: function (data) {
-                    $scope.themes = data;
-                }
-            });
-            $scope.selectedTheme = $scope.themes[0];
-        }]);
-
-
     var saveButton;
 
     $( document ).ready(function() {
+
         saveButton = $("#createWeblog_0");
-        formChanged();
+
+        <s:if test="bean.theme == null">
+        previewImage('<s:property value="themes[0].id"/>');
+        </s:if>
+        <s:else>
+        previewImage('<s:property value="bean.theme"/>');
+        </s:else>
     });
 
     function formChanged() {
@@ -127,7 +118,6 @@
             saveButton.attr("disabled", true);
             saveButton.addClass("btn-danger");
         }
-
     }
 
     function validateEmail(email) {
@@ -144,10 +134,17 @@
         } else {
             previewSpan.replaceChild(n2, n1);
         }
-        formChanged();
     }
 
-    formChanged();
+    function previewImage(themeId) {
+        $.ajax({ url: "<s:property value='siteURL' 
/>/roller-ui/authoring/themedata",
+            data: {theme:themeId}, success: function(data) {
+                $('#themedescription').html(data.description);
+                $('#themeThumbnail').attr('src','<s:property value="siteURL" 
/>' + data.previewPath);
+            }
+        });
+        formChanged();
+    }
 
 </script>
 

Reply via email to