Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
okazy committed Jun 25, 2020
0 parents commit c72c6f3
Showing 12 changed files with 334 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

name: Packaging for EC-CUBE Plugin
on:
release:
types: [ published ]
jobs:
deploy:
name: Build
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Packaging
working-directory: ../
run: |
rm -rf $GITHUB_WORKSPACE/.github
find $GITHUB_WORKSPACE -name "dummy" -delete
find $GITHUB_WORKSPACE -name ".git*" -and ! -name ".gitkeep" -print0 | xargs -0 rm -rf
chmod -R o+w $GITHUB_WORKSPACE
cd $GITHUB_WORKSPACE
tar cvzf ../${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.tar.gz ./*
- name: Upload binaries to release of TGZ
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ runner.workspace }}/${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.tar.gz
asset_name: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.tar.gz
tag: ${{ github.ref }}
overwrite: true
52 changes: 52 additions & 0 deletions Controller/Admin/ConfigController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

namespace Plugin\CheckGitHubActions\Controller\Admin;

use Eccube\Controller\AbstractController;
use Plugin\CheckGitHubActions\Form\Type\Admin\ConfigType;
use Plugin\CheckGitHubActions\Repository\ConfigRepository;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;

class ConfigController extends AbstractController
{
/**
* @var ConfigRepository
*/
protected $configRepository;

/**
* ConfigController constructor.
*
* @param ConfigRepository $configRepository
*/
public function __construct(ConfigRepository $configRepository)
{
$this->configRepository = $configRepository;
}

/**
* @Route("/%eccube_admin_route%/check_git_hub_actions/config", name="check_git_hub_actions_admin_config")
* @Template("@CheckGitHubActions/admin/config.twig")
*/
public function index(Request $request)
{
$Config = $this->configRepository->get();
$form = $this->createForm(ConfigType::class, $Config);
$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {
$Config = $form->getData();
$this->entityManager->persist($Config);
$this->entityManager->flush($Config);
$this->addSuccess('登録しました。', 'admin');

return $this->redirectToRoute('check_git_hub_actions_admin_config');
}

return [
'form' => $form->createView(),
];
}
}
58 changes: 58 additions & 0 deletions Entity/Config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

namespace Plugin\CheckGitHubActions\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
* Config
*
* @ORM\Table(name="plg_check_git_hub_actions_config")
* @ORM\Entity(repositoryClass="Plugin\CheckGitHubActions\Repository\ConfigRepository")
*/
class Config
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer", options={"unsigned":true})
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;

/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255)
*/
private $name;

/**
* @return int
*/
public function getId()
{
return $this->id;
}

/**
* @return string
*/
public function getName()
{
return $this->name;
}

/**
* @param string $name
*
* @return $this;
*/
public function setName($name)
{
$this->name = $name;

return $this;
}
}
16 changes: 16 additions & 0 deletions Event.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Plugin\CheckGitHubActions;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class Event implements EventSubscriberInterface
{
/**
* @return array
*/
public static function getSubscribedEvents()
{
return [];
}
}
37 changes: 37 additions & 0 deletions Form/Type/Admin/ConfigType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace Plugin\CheckGitHubActions\Form\Type\Admin;

use Plugin\CheckGitHubActions\Entity\Config;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;

class ConfigType extends AbstractType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('name', TextType::class, [
'constraints' => [
new NotBlank(),
new Length(['max' => 255]),
],
]);
}

/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => Config::class,
]);
}
}
16 changes: 16 additions & 0 deletions Nav.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Plugin\CheckGitHubActions;

use Eccube\Common\EccubeNav;

class Nav implements EccubeNav
{
/**
* @return array
*/
public static function getNav()
{
return [];
}
}
36 changes: 36 additions & 0 deletions Repository/ConfigRepository.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace Plugin\CheckGitHubActions\Repository;

use Eccube\Repository\AbstractRepository;
use Plugin\CheckGitHubActions\Entity\Config;
use Symfony\Bridge\Doctrine\RegistryInterface;

/**
* ConfigRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class ConfigRepository extends AbstractRepository
{
/**
* ConfigRepository constructor.
*
* @param RegistryInterface $registry
*/
public function __construct(RegistryInterface $registry)
{
parent::__construct($registry, Config::class);
}

/**
* @param int $id
*
* @return null|Config
*/
public function get($id = 1)
{
return $this->find($id);
}
}
Empty file.
Empty file.
62 changes: 62 additions & 0 deletions Resource/template/admin/config.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{% extends '@admin/default_frame.twig' %}

{% set menus = ['store', 'plugin', 'plugin_list'] %}

{% block title %}CheckGitHubActions{% endblock %}
{% block sub_title %}プラグイン一覧{% endblock %}

{% form_theme form '@admin/Form/bootstrap_4_horizontal_layout.html.twig' %}

{% block stylesheet %}{% endblock stylesheet %}

{% block javascript %}{% endblock javascript %}

{% block main %}
<form role="form" method="post">

{{ form_widget(form._token) }}

<div class="c-contentsArea__cols">
<div class="c-contentsArea__primaryCol">
<div class="c-primaryCol">
<div class="card rounded border-0 mb-4">
<div class="card-header"><span>設定</span></div>
<div class="card-body">
<div class="row">
<div class="col-3"><span>名前</span><span
class="badge badge-primary ml-1">必須</span></div>
<div class="col mb-2">
{{ form_widget(form.name) }}
{{ form_errors(form.name) }}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="c-conversionArea">
<div class="c-conversionArea__container">
<div class="row justify-content-between align-items-center">
<div class="col-6">
<div class="c-conversionArea__leftBlockItem">
<a class="c-baseLink"
href="{{ url('admin_store_plugin') }}">
<i class="fa fa-backward" aria-hidden="true"></i>
<span>プラグイン一覧</span>
</a>
</div>
</div>
<div class="col-6">
<div class="row align-items-center justify-content-end">
<div class="col-auto">
<button class="btn btn-ec-conversion px-5"
type="submit">登録</button>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
{% endblock %}
16 changes: 16 additions & 0 deletions TwigBlock.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Plugin\CheckGitHubActions;

use Eccube\Common\EccubeTwigBlock;

class TwigBlock implements EccubeTwigBlock
{
/**
* @return array
*/
public static function getTwigBlock()
{
return [];
}
}
12 changes: 12 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "ec-cube/CheckGitHubActions",
"version": "1.0.0",
"description": "CheckGitHubActions",
"type": "eccube-plugin",
"require": {
"ec-cube/plugin-installer": "~0.0.7"
},
"extra": {
"code": "CheckGitHubActions"
}
}

0 comments on commit c72c6f3

Please sign in to comment.