Permalink
Browse files

Add chat channel field to projects and improve project links

  • Loading branch information...
themightychris committed Sep 25, 2016
1 parent 5b828dd commit 4e757ea9844ce613903b359c76c2a594de4ba3b1
@@ -86,10 +86,30 @@
<div class="col-md-4">
<h2>{_ "Project Info"}</h2>
- <!-- PROJECT LINKS -->
- <div class="btn-group btn-group-justified" role="group" aria-label="...">
- {if $Project->UsersUrl}<a class="btn btn-primary" role="button" href="{$Project->UsersUrl|escape}">{glyph "link"}&nbsp;Public Site</a>{/if}
- {if $Project->DevelopersUrl}<a class="btn btn-success" role="button" href="{$Project->DevelopersUrl|escape}">{glyph "link"}&nbsp;Developers</a>{/if}
+ <!-- PROJECT LINKS -->
+ <div role="group" aria-label="...">
+ {if $Project->UsersUrl}
+ <a class="btn btn-primary btn-block" role="button" href="{$Project->UsersUrl|escape}">
+ {glyph "user"}&nbsp;Users' Site
+ <div class="small">{$Project->UsersUrl|escape}</div>
+ </a>
+ {/if}
+ {if $Project->DevelopersUrl}
+ <a class="btn btn-success btn-block" role="button" href="{$Project->DevelopersUrl|escape}">
+ {glyph "cog"}&nbsp;Developers' Site
+ <div class="small">{$Project->DevelopersUrl|escape}</div>
+ </a>
+ {/if}
+ {if $Project->ChatChannel}
+ {if Laddr::$chatLinker}
+ <a class="btn btn-success btn-block" role="button" href="{call_user_func(Laddr::$chatLinker, $Project->ChatChannel)|escape}">
+ {glyph "comment"}&nbsp;Chat Channel
+ <div class="small">#{$Project->ChatChannel|escape}</div>
+ </a>
+ {else}
+ <p class="text-center">Chat Channel: <strong>#{$Project->ChatChannel|escape}</strong></p>
+ {/if}
+ {/if}
</div>
<!-- MEMBERS BLOCK -->
@@ -121,6 +141,7 @@
<a class="btn btn-success add-person" href="#add-member" data-toggle="modal">+ {_ "Add"}</a>
{/if}
<hr>
+
<!-- TAGS BLOCK -->
{if $Project->TechTags}
{_ "Tech"}:
@@ -42,13 +42,17 @@
<input name="Title" id="field-title" class="form-control" placeholder="{_ 'Train Schedule Analyzer'}" value="{refill field=Title default=$Project->Title}" />
</div>
<div class="form-group">
- <label for="field-url-users">{_ "Users' URL"}:</label>
+ <label for="field-url-users">{_ "URL for Users"}:</label>
<input type="url" name="UsersUrl" id="field-url-users" class="form-control" placeholder="{_ 'http://mypublicapp.org'}" value="{refill field=UsersUrl default=$Project->UsersUrl}" />
</div>
<div class="form-group">
- <label for="field-url-developers">{_ "Developers' URL"}:</label>
+ <label for="field-url-developers">{_ "URL for Developers"}:</label>
<input type="url" name="DevelopersUrl" id="field-url-developers" class="form-control" placeholder="http://github.com/..." value="{refill field=DevelopersUrl default=$Project->DevelopersUrl}"/>
</div>
+ <div class="form-group">
+ <label for="field-chat-channel">{_ "Chat Channel/Hashtag"}:</label>
+ <input name="ChatChannel" id="field-chat-channel" class="form-control" placeholder="train_schedule_analyzer" value="{refill field=ChatChannel default=$Project->ChatChannel}"/>
+ </div>
<div class="form-group">
<label for="topicTagsInput">{_ 'Topic Tags'}:</label>
<input type="tags" data-tag-prefix="topic" id="topicTagsInput" class="form-control" name="tags[topic]" placeholder="{_ 'Education, Mapping, Crime'}" value="{refill field=tags.topic default=Tag::getTagsString($Project->Tags, topic)}"/>
View
@@ -5,6 +5,7 @@ class Laddr
public static $siteName;
public static $siteAbbr;
public static $siteSlogan;
+ public static $chatLinker;
static function __classLoaded()
{
@@ -58,6 +58,10 @@ class Project extends \VersionedRecord
'Hibernating'
],
'default' => 'Commenting'
+ ],
+ 'ChatChannel' => [
+ 'type' => 'string',
+ 'default' => null
]
];
@@ -0,0 +1,13 @@
+<?php
+
+/*
+Laddr::$chatLinker = function($channel = null) {
+ $url = '/chat';
+
+ if ($channel) {
+ $url .= '?channel=' . urlencode($channel);
+ }
+
+ return $url;
+};
+*/
@@ -0,0 +1,26 @@
+<?php
+
+use Laddr\Project;
+
+// skip conditions
+if (!static::tableExists(Project::$tableName)) {
+ printf("Skipping migration because table `%s` does not exist yet\n", Project::$tableName);
+ return static::STATUS_SKIPPED;
+}
+
+if (static::columnExists(Project::$tableName, 'ChatChannel')) {
+ printf("Skipping migration because column `ChatChannel` in table `%s` already exists\n", Project::$tableName);
+ return static::STATUS_SKIPPED;
+}
+
+
+// migration
+printf("Adding `ChatChannel` column to `%s` table\n", Project::$tableName);
+DB::nonQuery('ALTER TABLE `%s` ADD `ChatChannel` varchar(255) NULL default NULL', Project::$tableName);
+
+printf("Adding `ChatChannel` column to `%s` table\n", Project::$historyTable);
+DB::nonQuery('ALTER TABLE `%s` ADD `ChatChannel` varchar(255) NULL default NULL', Project::$historyTable);
+
+
+// done
+return static::STATUS_EXECUTED;

0 comments on commit 4e757ea

Please sign in to comment.