Commits

Ben Woskow  committed b63c9c8

initial commit for sample plugin

  • Participants

Comments (0)

Files changed (6)

+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>com.atlassian.streams</groupId>
+    <artifactId>inline-actions-sample-plugin</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <organization>
+        <name>Example Company</name>
+        <url>http://www.example.com/</url>
+    </organization>
+
+    <name>Inline Actions Sample Plugin</name>
+    <description>This is the Inline Actions sample plugin for Atlassian Activity Streams.</description>
+    <packaging>atlassian-plugin</packaging>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>com.atlassian.maven.plugins</groupId>
+                <artifactId>maven-amps-plugin</artifactId>
+                <version>3.5-m7</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <contextPath>/streams</contextPath>
+                    <httpPort>3990</httpPort>
+                    <products>
+                        <product>
+                            <id>jira</id>
+                            <version>${jira.version}</version>
+                            <productDataPath>${basedir}/src/test/resources/jira-base.zip</productDataPath>
+                        </product>
+                    </products>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <properties>
+        <jira.version>5.0-alpha3</jira.version>
+    </properties>
+
+</project>

File src/main/resources/atlassian-plugin.xml

+<atlassian-plugin key="com.atlassian.streams.inline-actions-sample-plugin" name="Inline Actions Sample Plugin" pluginsVersion="2">
+    <plugin-info>
+        <description>Fisheye/Crucible Streams Inline Actions Plugin</description>
+        <version>1.0-SNAPSHOT</version>
+        <vendor name="Atlassian Software Systems Pty Ltd" url="http://www.atlassian.com/"/>
+    </plugin-info>
+
+    <streams-action-handlers key="actionHandlers">
+        <transformation extension="i18n.js">
+            <transformer key="action-i18n-transformer" />
+        </transformation>
+
+        <resource type="download" name="streams.sample.action.i18n.js" location="/js/inline-actions/streams.sample.action.i18n.js"/>
+        <resource type="download" name="sample-action.js" location="/js/inline-actions/sample-action.js"/>
+    </streams-action-handlers>
+
+    <resource type="i18n" name="sample-actions-i18n" location="com.atlassian.streams.sample.inline-actions.i18n"/>
+    
+</atlassian-plugin>

File src/main/resources/com/atlassian/streams/sample/inline-actions/i18n.properties

+streams.sample.action.moreinformation.title=More Information

File src/main/resources/js/inline-actions/sample-action.js

+/**
+ * Registers a "More Information" action against any feed items with a "issue" type.
+ * 
+ * Creates a link which goes to the issue page.
+ */
+(function() {
+
+    /**
+     * Builds a link to go to the issue page.
+     * 
+     * @method buildLink
+     * @param {Object} feedItem Object representing the activity item
+     * @return {HTMLElement}
+     */
+    function buildLink(feedItem) {
+        var url = feedItem.links['alternate'];
+
+        if (!url) {
+            return;
+        }
+
+        return AJS.$('<a class="activity-item-sample-action-link"></a>')
+                .attr('href', url)
+                .text(ActivityStreams.i18n.get('streams.sample.action.moreinformation.title'));
+    }
+
+    // Registers the action for any issues in the feed
+    ActivityStreams.registerAction('issue', buildLink, 5);
+})();

File src/main/resources/js/inline-actions/streams.sample.action.i18n.js

+
+// This file is intentionally left blank. It is used to prevent the web resource system from complaining about missing files
+// when Activity Streams adds your internationalized text to your inline actions plugin.

File src/test/resources/jira-base.zip

Binary file added.