Commits

Theresa Henze committed dc74ce2 Draft

Removed not working hidden parameter; styles for box macro corrected

Comments (0)

Files changed (5)

 ## Macros
 
 TODO: Icon, documentationURL, categories
+https://developer.atlassian.com/display/CONFDEV/Including+Information+in+your+Macro+for+the+Macro+Browser
 
 ### Insert with custom GUI
 
 
 #### Hidden Parameters
 
-Done
+TODO
+https://developer.atlassian.com/display/CONFDEV/Including+Information+in+your+Macro+for+the+Macro+Browser
 
 
 ### Image place holder

src/main/resources/atlassian-plugin.xml

 				<option key="showValueInPlaceholder" value="true" />
 			</default>
 
+			<!--
 			<parameter name="willbehidden" type="string" />
+			-->
 
 			<!-- type: one of (string, boolean, enum, int, relativedate, url, color, 
 				label, date, username, group, confluence-content, spacekey) -->
 		<resource type="download" name="editor-format.js" location="js/editor-format.js" />
 	</web-resource>
 
+<!-- 
 	<web-resource name="Box Resource - add a hidden field"
 		key="hidden-field-parameter">
 		<description>Hide parameter field in box macro</description>
 		</dependency>
 		<context>macro-browser</context>
 	</web-resource>
-
+ -->
+ 
 	<web-resource name="CSS Resource" key="css-resources">
 		<description>CSS resource for all macros</description>
 		<context>editor</context>

src/main/resources/css/macromagic.css

-#insert-menu .aui-dropdown #insert-macro-box .icon {
+#insert-menu .aui-dropdown #box .icon {
 	background-image: url(images/16x16_package.png);
 	background-position: left center;
 	background-repeat: no-repeat;

src/main/resources/js/editor-hillsite.js

 		var selection = AJS.Rte.getEditor().selection.getNode();
 		var macro = {
 				name: macroName
-// we don't have parameters or a body
-//				params: {
-//					title: 'some title'
-//				},
-//              defaultParameterValue: "",
-//				body: ''
 		};
 		
 		// convert macro and insert in DOM
 	
 	// bind event to open macro browser
 	AJS.MacroBrowser.setMacroJsOverride(macroName, {opener: function(macro) {
-		// instead open dialog
+		
+		// open custom dialog
         dialog.show();
-		AJS.log(macro);
+        
+		// we have a macro object here, like the one we're creating later:
+//		var macro = {
+//			name: macroName
+//			params: {
+//				title: 'some title'
+//			},
+//			defaultParameterValue: "",
+//			body: ''
+//		};
 	}});
 }); 

src/main/resources/js/hidden-parameter.js

-AJS.MacroBrowser.getMacroJsOverride("box").fields.string = {
-  "willbehidden": function(param) {
-    var parameterField = AJS.MacroBrowser.ParameterFields["_hidden"] (param, {});
-    if (!parameterField.getValue()) {
-      parameterField.setValue('hidden field value');
-    }
-    return parameterField;
-  }
-};
+// bind on initialization of editor
+AJS.bind("init.rte", function() { 
+	
+	var macroName = "box";
+	
+	AJS.log("BIND a HIDE FIELD");
+	
+	AJS.MacroBrowser.getMacroJsOverride(macroName).fields.string = {"willbehidden": function(param) {
+		AJS.log("HIDE FIELD");
+	    var parameterField = AJS.MacroBrowser.ParameterFields["_hidden"] (param, {});
+	    if (!parameterField.getValue()) {
+	      parameterField.setValue('hidden field value');
+	    }
+	    return parameterField;
+	  }
+	};
+});