1. Max Zaets
  2. yii-scm-issues

Commits

Max Zaets  committed 0e8ab82

changed module settings, updated readme and a default controller with some startup code

  • Participants
  • Parent commits b9effd0
  • Branches master

Comments (0)

Files changed (3)

File IssuesModule.php

View file
  • Ignore whitespace
     public $defaultController = 'tracker';
 
     /**
-     * Your Bitbucket username
+     * SCM provider
+     */
+    public $provider;
+
+    /**
+     * Your SCM provider username
      */
     public $username;
 
     /**
-     * Your Bitbucket Password
+     * Your SCM provider Password
      */
     public $password;
 
     /**
-     * Your Bitbucket repo slug (see https://confluence.atlassian.com/display/BITBUCKET/What+is+a+Slug)
+     * Your repo slug (see https://confluence.atlassian.com/display/BITBUCKET/What+is+a+Slug)
      */
     public $repoSlug;
 
     /**
      * Hide issues with this type set
+     * TODO: deal with this, either leave or implement support of
      */
-    public $hideIssues = array('resolved', 'wontfix', 'duplicate', 'invalid');
+    /*public $hideIssues = array('resolved', 'wontfix', 'duplicate', 'invalid');*/
 
     /**
      * Allowed Git SCM providers
+     * If you want to use a provider other than the bundled one,
+     * see models/ScmProvider.php for implementation details.
      */
     protected $providers = array('github', 'bitbucket');
 
-    /**
-     * Git SCM provider
-     */
-    public $provider;
-
     public function init()
 	{
 		// this method is called when the module is being created
         // check if there's a proper provider set
         if(!in_array($this->provider, $this->providers, true))
         {
-            throw new CException(Yii::t('issues', 'Wrong Git SCM provider set, please check your config file.'));
+            throw new CException(Yii::t('issues', 'Wrong SCM provider set, please check your config file.'));
         }
 	}
 

File README.md

View file
  • Ignore whitespace
-Yii Bitbucket Issues Module
+Yii SCM Issues Module
 ===========================
 
 What is it?
 -----------
 
-This module allows  This module allows you to set up a page in a restricted area of your web site. On this page users can communicate with you through issues, which are hosted on a Bitbucket repo, associated with your website. I think it's more convinient to handle all feedback in on place.
+This module allows you to set up a page in a restricted area of your web site.
+On this page users can communicate with you through issues, which are hosted on a GitHub/Bitbucket/(implement your own SCM provider wrapper) repo, associated with your website.
+It's a more convenient way to handle all feedback in on place.
+
+What it's not?
+--------------
+
+It's not a feedback form.
+It's not a complete replace for a GitHub/Bitbucket web UI.
 
 Setup
 -----
 * Extract modules' contents into /protected/modules directory
 * In config.php add
 
-
-    'modules' => array(
-        // .. some code here ..
-        'issues' => array(
-        'username' => 'your_bitbucket_username',
-        'password' => 'your_bitbucket_password',
-        'repoSlug' => 'your_bitbucket_repo_slug' // see https://confluence.atlassian.com/display/BITBUCKET/What+is+a+Slug
-        'hideIssues' => array(
-            // types of issues you want to hide
-            'resolved', 'wontfix', 'duplicate', 'invalid'
-        )
-    )
-
+        'modules' => array(
+            // ... some code here ...
+            'issues' => array(
+                'provider' => 'github', // see models/ScmProvider.php file for custom providers
+                'username' => 'your_scm_username',
+                'password' => 'your_scm_password',
+                'repoSlug' => 'your_scm_repo_slug', //basically a part of your repo's URL which represents repo's name in a URL-friendly format
+            ),
+            // ... some code here ...
+        ),
 
 * Proceed to http://your-yii-app/issues

File controllers/TrackerController.php

View file
  • Ignore whitespace
 class TrackerController extends Controller
 {
     public $layout = 'main';
+    private $_provider;
+
+    public function beforeAction($action)
+    {
+        parent::beforeAction($action);
+
+        $this->_provider = ucfirst($this->module->provider).'ScmProvider';
+
+        return true;
+    }
 
     public function actionIndex()
     {
+        // TODO: replace with the actual code
+        $provider = new $this->_provider();
+
         $this->render('index');
     }
 }