Skip to content

Commit

Permalink
added ability to set which branch to install
Browse files Browse the repository at this point in the history
  • Loading branch information
rsanchez committed May 2, 2012
1 parent de6a9aa commit f43f424
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Expand Up @@ -26,6 +26,7 @@
'addon_reinstall' => 'Re-install/Update',
'addon_update' => 'Update Available',// %s',
'addon_author' => 'Author',
'addon_branch' => 'Branch',
'addon_github_url' => 'GitHub URL',
'filter_by_status' => 'Filter By Status',
'filter_by_author' => 'Filter By Author',
Expand Down
Expand Up @@ -110,18 +110,21 @@ public function index()
//$install = (in_array($addon, $current_addons)) ? lang('addon_install') : lang('addon_reinstall');

$url = 'https://github.com/'.$params['user'].'/'.$params['repo'];

if (isset($params['branch']))
{
$url .= '/tree/'.$params['branch'];
}


$branch = isset($params['branch']) ? $params['branch'] : 'master';

$vars['addons'][] = array(
'name' => $name,//.$description,
'github_url' => anchor($url, $url, 'rel="external"'),
'branch' => form_input("", $branch, 'class="branch '.$addon.'-branch"'),
'author' => $params['user'],
'status' => $status,
'install' => anchor($this->base.AMP.'method=install'.AMP.'addon='.$addon, lang('addon_install'))
'install' => anchor($this->base.AMP.'method=install'.AMP.'addon='.$addon, lang('addon_install'), 'data-addon="'.$addon.'"')
);
}

Expand All @@ -142,7 +145,7 @@ public function index()
a.html("'.lang('addon_installing').'");
$.get(
$(this).attr("href"),
"",
{branch: $("."+$(this).data("addon")+"-branch").val()},
function(data){
tds.animate({backgroundColor:originalColor});
a.html(originalText);
Expand Down Expand Up @@ -235,6 +238,11 @@ public function install()
$params = $this->manifest[$addon];

$params['name'] = $addon;

if ($this->EE->input->get('branch'))
{
$params['branch'] = $this->EE->input->get('branch');
}

$this->EE->session->set_flashdata('addon', $addon);

Expand Down
Expand Up @@ -27,6 +27,7 @@
<tr>
<th class="addon_name"><?=lang('addon_name')?></th>
<th class="addon_github_url"><?=lang('addon_github_url')?></th>
<th class="addon_branch"><?=lang('addon_branch')?></th>
<th class="addon_author"><?=lang('addon_author')?></th>
<th class="addon_status"><?=lang('addon_status')?></th>
<th>&nbsp;</th>
Expand All @@ -37,6 +38,7 @@
<tr class="<?=alternator('even', 'odd')?>">
<td class="addon_name"><?=element('name', $addon)?></td>
<td class="addon_github_url"><?=element('github_url', $addon)?></td>
<td class="addon_branch"><?=element('branch', $addon)?></td>
<td class="addon_author"><?=element('author', $addon)?></td>
<td class="addon_status"><?=element('status', $addon)?></td>
<td class="addon_install"><?=element('install', $addon)?></td>
Expand Down

0 comments on commit f43f424

Please sign in to comment.