author
int64
658
755k
date
stringlengths
19
19
timezone
int64
-46,800
43.2k
hash
stringlengths
40
40
message
stringlengths
5
490
mods
list
language
stringclasses
20 values
license
stringclasses
3 values
repo
stringlengths
5
68
original_message
stringlengths
12
491
398,795
06.02.2022 02:16:54
0
4fd4a7d5463b9413360fe1cc85364a3077390448
Add parser round trip test to CI
[ { "change_type": "MODIFY", "old_path": ".github/workflows/ci.yml", "new_path": ".github/workflows/ci.yml", "diff": "@@ -63,6 +63,22 @@ jobs:\nbundler-cache: true\nruby-version: ${{ matrix.ruby }}\n- run: bundle exec bin/corpus\n+ ruby-parser-round-trip-tests:\n+ name: Parser Round Trip Tests\n+ runs-on: ${{ matrix.os }}\n+ timeout-minutes: 10\n+ strategy:\n+ fail-fast: false\n+ matrix:\n+ ruby: [ruby-2.6, ruby-2.7, ruby-3.0]\n+ os: [macos-latest, ubuntu-latest]\n+ steps:\n+ - uses: actions/checkout@v2\n+ - uses: ruby/setup-ruby@v1\n+ with:\n+ bundler-cache: true\n+ ruby-version: ${{ matrix.ruby }}\n+ - run: bundle exec ruby bin/parser-round-trip-test\nruby-rubocop:\nname: Rubocop\nruns-on: ${{ matrix.os }}\n" }, { "change_type": "MODIFY", "old_path": "Changelog.md", "new_path": "Changelog.md", "diff": "* Fix emit of of `match_pattern` vs `match_pattern_p`\n+[#298](https://github.com/mbj/unparser/pull/298)\n+\n+* Add round trip tests dynamically derived from the `parser` gems test suite to CI\n+\n# v0.6.3 2022-01-16\n[#290](https://github.com/mbj/unparser/pull/290)\n" }, { "change_type": "RENAME", "old_path": "test/run-parser-tests.rb", "new_path": "bin/parser-round-trip-test", "diff": "+#!/usr/bin/env ruby\n+# frozen_string_literal: true\n+\nrequire 'unparser'\n-$: << __dir__\n+# Hack to dynamically re-use the `parser` gems test suite on CI.\n+# The main idea is create a fake minitet runner to capture the\n+# signature of the examples encoded in the parsers test suite dynamically.\n+#\n+# This makes maintenance much more easier, especially on tracking new ruby\n+# syntax addtions.\n+#\n+# The API surface of the parser tests so far is low churn, while it may still\n+# make sense to provide the parser tests as an more easy to re-use data upstream.\n-testBuilder = Class.new(Parser::Builders::Default)\n-testBuilder.modernize\n+$LOAD_PATH << Pathname.new(__dir__).parent.join('test')\n-MODERN_ATTRIBUTES = testBuilder.instance_variables.map do |instance_variable|\n- attribute_name = instance_variable.to_s[1..-1].to_sym\n- [attribute_name, testBuilder.public_send(attribute_name)]\n-end.to_h\n+test_builder = Class.new(Parser::Builders::Default)\n+test_builder.modernize\n+\n+MODERN_ATTRIBUTES = test_builder.instance_variables.to_h do |instance_variable|\n+ attribute_name = instance_variable.to_s[1..].to_sym\n+ [attribute_name, test_builder.public_send(attribute_name)]\n+end\n+# Overwrite global scope method in the parser test suite\ndef default_builder_attributes\n- MODERN_ATTRIBUTES.keys.map do |attribute_name|\n+ MODERN_ATTRIBUTES.keys.to_h do |attribute_name|\n[attribute_name, Parser::Builders::Default.public_send(attribute_name)]\n- end.to_h\n+ end\nend\nclass Test\n@@ -26,13 +40,11 @@ class Test\n:rubies\n)\n- TARGET_RUBIES = %w[2.6 2.7]\n-\nEXPECT_FAILURE = {}.freeze\ndef legacy_attributes\n- default_builder_attributes.select do |attribute_name, value|\n- !MODERN_ATTRIBUTES.fetch(attribute_name).equal?(value)\n+ default_builder_attributes.reject do |attribute_name, value|\n+ MODERN_ATTRIBUTES.fetch(attribute_name).equal?(value)\nend.to_h\nend\nmemoize :legacy_attributes\n@@ -43,7 +55,7 @@ class Test\nelsif !allow_ruby?\n\"Non targeted rubies: #{rubies.join(',')}\"\nelsif validation.original_node.left?\n- \"Test specifies a syntax error\"\n+ 'Test specifies a syntax error'\nend\nend\n@@ -56,18 +68,21 @@ class Test\nend\ndef allow_ruby?\n- rubies.empty? || rubies.any?(TARGET_RUBIES.method(:include?))\n+ rubies.empty? || rubies.include?(RUBY_VERSION)\nend\ndef right(value)\nUnparser::Either::Right.new(value)\nend\n+ # rubocop:disable Metrics/AbcSize\ndef validation\nidentification = name.to_s\n+\ngenerated_source = Unparser.unparse_either(node)\n+ .fmap { |string| string.dup.force_encoding(parser_source.encoding).freeze }\n- generated_node = generated_source.lmap{ |_value| }.bind do |source|\n+ generated_node = generated_source.bind do |source|\nparse_either(source, identification)\nend\n@@ -79,11 +94,12 @@ class Test\noriginal_source: right(parser_source)\n)\nend\n+ # rubocop:enable Metrics/AbcSize\nmemoize :validation\ndef parser\nUnparser.parser.tap do |parser|\n- %w(foo bar baz).each(&parser.static_env.method(:declare))\n+ %w[foo bar baz].each(&parser.static_env.method(:declare))\nend\nend\n@@ -115,7 +131,7 @@ private\ndef expect_failure\nif test.success?\n- fail format('Expected Failure', 'but got success')\n+ message('Expected Failure', 'but got success')\nelse\nprint('Expected Failure')\nend\n@@ -126,22 +142,32 @@ private\nprint('Success')\nelse\nputs(test.validation.report)\n- fail format('Failure')\n+ fail message('Failure')\nend\nend\n- def format(status, message = '')\n- '%3d/%3d: %-16s %s[%02d] %s' % [number, total, status, test.name, test.group_index, message]\n+ def message(status, message = '')\n+ format(\n+ '%3<number>d/%3<total>d: %-16<status>s %<name>s[%02<group_index>d] %<message>s',\n+ number: number,\n+ total: total,\n+ status: status,\n+ name: test.name,\n+ group_index: test.group_index,\n+ message: message\n+ )\nend\ndef print(status, message = '')\n- puts(format(status, message))\n+ puts(message(status, message))\nend\nend\nmodule Minitest\n- class Test\n- end # Test\n+ # Stub parent class\n+ # rubocop:disable Lint/EmptyClass\n+ class Test; end # Test\n+ # rubocop:enable Lint/EmptyClass\nend # Minitest\nclass Extractor\n@@ -183,19 +209,45 @@ class Extractor\nend\nend\n-require '../parser/test/parse_helper.rb'\n-require '../parser/test/test_parser.rb'\n+PARSER_PATH = Pathname.new('tmp/parser')\n+\n+unless PARSER_PATH.exist?\n+ Kernel.system(\n+ *%W[\n+ git\n+ clone\n+ https://github.com/whitequark/parser\n+ #{PARSER_PATH}\n+ ],\n+ exception: true\n+ )\n+end\n+\n+Dir.chdir(PARSER_PATH) do\n+ Kernel.system(\n+ *%W[\n+ git\n+ checkout\n+ v#{Parser::VERSION}\n+ ],\n+ exception: true\n+ )\n+ Kernel.system(*%w[git clean --force -d -X], exception: true)\n+end\n+\n+require \"./#{PARSER_PATH}/test/parse_helper\"\n+require \"./#{PARSER_PATH}/test/test_parser\"\nEXTRACTOR = Extractor.new\nmodule ParseHelper\n- def assert_diagnoses(*arguments)\n- end\n+ def assert_diagnoses(*arguments); end\ndef s(type, *children)\nParser::AST::Node.new(type, children)\nend\n+ # rubocop:disable Metrics/ParameterLists\ndef assert_parses(node, parser_source, _diagnostics = nil, rubies = [])\nEXTRACTOR.capture(\ndefault_builder_attributes: default_builder_attributes,\n@@ -204,21 +256,17 @@ module ParseHelper\nrubies: rubies\n)\nend\n+ # rubocop:enable Metrics/ParameterLists\n- def test_clrf_line_endings(*arguments)\n- end\n+ def test_clrf_line_endings(*arguments); end\n- def with_versions(*arguments)\n- end\n+ def with_versions(*arguments); end\n- def assert_context(*arguments)\n- end\n+ def assert_context(*arguments); end\n- def refute_diagnoses(*arguments)\n- end\n+ def refute_diagnoses(*arguments); end\n- def assert_diagnoses_many(*arguments)\n- end\n+ def assert_diagnoses_many(*arguments); end\nend\nTestParser.instance_methods.grep(/\\Atest_/).each(&EXTRACTOR.method(:call))\n" } ]
Ruby
MIT License
mbj/unparser
Add parser round trip test to CI
398,795
12.02.2022 16:26:06
0
e6d23011392d8029936227d3c8f3530eba1eca91
Add find_pattern and matcH_rest support * These where not found as the parser round trip tests where false positive.
[ { "change_type": "MODIFY", "old_path": "Changelog.md", "new_path": "Changelog.md", "diff": "+# v0.6.3 2022-02-12\n+\n+[#300](https://github.com/mbj/unparser/pull/300)\n+\n+* Add 3.0+ node support for `find_pattern` and `match_rest`\n+\n+[#298](https://github.com/mbj/unparser/pull/298)\n+\n+* Add `parser` gem derived round trip tests.\n+\n# v0.6.2 2022-02-05\n[#297](https://github.com/mbj/unparser/pull/297)\n" }, { "change_type": "MODIFY", "old_path": "bin/parser-round-trip-test", "new_path": "bin/parser-round-trip-test", "diff": "@@ -68,7 +68,7 @@ class Test\nend\ndef allow_ruby?\n- rubies.empty? || rubies.include?(RUBY_VERSION)\n+ rubies.empty? || rubies.include?(RUBY_VERSION.split('.').take(2).join('.'))\nend\ndef right(value)\n" }, { "change_type": "MODIFY", "old_path": "config/mutant.yml", "new_path": "config/mutant.yml", "diff": "@@ -25,11 +25,13 @@ matcher:\n- 'Unparser::Emitter::Class#dispatch'\n- 'Unparser::Emitter::Class#local_variable_scope'\n- 'Unparser::Emitter::Def#local_variable_scope'\n+ - 'Unparser::Emitter::FindPattern#dispatch' # 3.0+ specific\n- 'Unparser::Emitter::HashPattern#write_symbol_body'\n- 'Unparser::Emitter::LocalVariableRoot*'\n- 'Unparser::Emitter::LocalVariableRoot.included'\n- 'Unparser::Emitter::MatchPattern#dispatch' # 2.7+ specific\n- 'Unparser::Emitter::MatchPatternP#dispatch' # 3.0+ specific\n+ - 'Unparser::Emitter::MatchRest#dispatch' # 3.0+ specific\n- 'Unparser::Emitter::Module#local_variable_scope'\n- 'Unparser::Emitter::Root#local_variable_scope'\n- 'Unparser::Emitter::Send#writer'\n" }, { "change_type": "MODIFY", "old_path": "lib/unparser.rb", "new_path": "lib/unparser.rb", "diff": "@@ -218,6 +218,7 @@ require 'unparser/emitter/xstr'\nrequire 'unparser/emitter/yield'\nrequire 'unparser/emitter/kwargs'\nrequire 'unparser/emitter/pair'\n+require 'unparser/emitter/find_pattern'\nrequire 'unparser/emitter/match_pattern'\nrequire 'unparser/emitter/match_pattern_p'\nrequire 'unparser/writer'\n" }, { "change_type": "ADD", "old_path": null, "new_path": "lib/unparser/emitter/find_pattern.rb", "diff": "+# frozen_string_literal: true\n+\n+module Unparser\n+ class Emitter\n+ # Emitter for in pattern nodes\n+ class FindPattern < self\n+ handle :find_pattern\n+\n+ private\n+\n+ def dispatch\n+ write('[')\n+ delimited(children)\n+ write(']')\n+ end\n+ end # FindPattern\n+ end # Emitter\n+end # Unparser\n" }, { "change_type": "MODIFY", "old_path": "lib/unparser/emitter/match_rest.rb", "new_path": "lib/unparser/emitter/match_rest.rb", "diff": "@@ -4,8 +4,15 @@ module Unparser\nclass Emitter\n# Emiter for match rest nodes\nclass MatchRest < self\n+ handle :match_rest\n+\nchildren :match_var\n+ def dispatch\n+ write('*')\n+ visit(match_var) if match_var\n+ end\n+\ndef emit_array_pattern\nwrite('*')\nemit_match_var\n" }, { "change_type": "MODIFY", "old_path": "test/corpus/literal/since/30.rb", "new_path": "test/corpus/literal/since/30.rb", "diff": "1 => [a]\n1 => [*]\n+1 in [*, 42, *]\n+1 in [*, a, *foo]\n" } ]
Ruby
MIT License
mbj/unparser
Add find_pattern and matcH_rest support * These where not found as the parser round trip tests where false positive.
398,795
05.02.2022 20:45:58
0
eb8a8399579ede116bcee4cb49dc6e1d78110b8e
Add 3.1 syntax support
[ { "change_type": "MODIFY", "old_path": ".github/workflows/ci.yml", "new_path": ".github/workflows/ci.yml", "diff": "@@ -20,7 +20,7 @@ jobs:\nstrategy:\nfail-fast: false\nmatrix:\n- ruby: [ruby-2.6, ruby-2.7, ruby-3.0]\n+ ruby: [ruby-2.6, ruby-2.7, ruby-3.0, ruby-3.1]\nos: [ubuntu-latest]\nsteps:\n- uses: actions/checkout@v2\n@@ -36,7 +36,7 @@ jobs:\nstrategy:\nfail-fast: false\nmatrix:\n- ruby: [ruby-2.6, ruby-2.7, ruby-3.0]\n+ ruby: [ruby-2.6, ruby-2.7, ruby-3.0, ruby-3.1]\nos: [macos-latest, ubuntu-latest]\nsteps:\n- uses: actions/checkout@v2\n@@ -54,7 +54,7 @@ jobs:\nstrategy:\nfail-fast: false\nmatrix:\n- ruby: [ruby-2.6, ruby-2.7, ruby-3.0]\n+ ruby: [ruby-2.6, ruby-2.7, ruby-3.0, ruby-3.1]\nos: [macos-latest, ubuntu-latest]\nsteps:\n- uses: actions/checkout@v2\n@@ -70,7 +70,7 @@ jobs:\nstrategy:\nfail-fast: false\nmatrix:\n- ruby: [ruby-2.6, ruby-2.7, ruby-3.0]\n+ ruby: [ruby-2.6, ruby-2.7, ruby-3.0, ruby-3.1]\nos: [macos-latest, ubuntu-latest]\nsteps:\n- uses: actions/checkout@v2\n@@ -86,7 +86,7 @@ jobs:\nstrategy:\nfail-fast: false\nmatrix:\n- ruby: [ruby-2.6, ruby-2.7, ruby-3.0]\n+ ruby: [ruby-2.6, ruby-2.7, ruby-3.0, ruby-3.1]\nos: [macos-latest, ubuntu-latest]\nsteps:\n- uses: actions/checkout@v2\n" }, { "change_type": "MODIFY", "old_path": "Changelog.md", "new_path": "Changelog.md", "diff": "-# v0.6.3 2022-02-12\n+# v0.6.4 2022-02-12\n+\n+[#299](https://github.com/mbj/unparser/pull/299)\n+\n+* Add 3.1+ syntax support.\n[#300](https://github.com/mbj/unparser/pull/300)\n* Add `parser` gem derived round trip tests.\n-# v0.6.2 2022-02-05\n-\n[#297](https://github.com/mbj/unparser/pull/297)\n* Fix emit of of `match_pattern` vs `match_pattern_p`\n" }, { "change_type": "MODIFY", "old_path": "Gemfile.lock", "new_path": "Gemfile.lock", "diff": "@@ -13,7 +13,7 @@ GIT\nPATH\nremote: .\nspecs:\n- unparser (0.6.3)\n+ unparser (0.6.4)\ndiff-lcs (~> 1.3)\nparser (>= 3.1.0)\n@@ -84,4 +84,4 @@ DEPENDENCIES\nunparser!\nBUNDLED WITH\n- 2.2.29\n+ 2.3.6\n" }, { "change_type": "MODIFY", "old_path": "config/mutant.yml", "new_path": "config/mutant.yml", "diff": "@@ -8,8 +8,6 @@ matcher:\nsubjects:\n- 'Unparser*'\nignore:\n- # API changed between ruby versions and each of them\n- # have a different minimal form\n- 'Unparser::Builder#initialize'\n- 'Unparser::CLI*'\n- 'Unparser::Concord#define_readers'\n@@ -22,6 +20,7 @@ matcher:\n- 'Unparser::Emitter::Array#emitters'\n- 'Unparser::Emitter::Binary#writer'\n- 'Unparser::Emitter::Block#target_writer'\n+ - 'Unparser::Emitter::BlockPass#dispatch' # 3.1+ specific\n- 'Unparser::Emitter::Class#dispatch'\n- 'Unparser::Emitter::Class#local_variable_scope'\n- 'Unparser::Emitter::Def#local_variable_scope'\n" }, { "change_type": "MODIFY", "old_path": "lib/unparser/emitter/argument.rb", "new_path": "lib/unparser/emitter/argument.rb", "diff": "@@ -127,7 +127,7 @@ module Unparser\ndef dispatch\nwrite('&')\n- visit(name)\n+ visit(name) if name\nend\nend # BlockPass\n" }, { "change_type": "MODIFY", "old_path": "spec/integrations.yml", "new_path": "spec/integrations.yml", "diff": "---\n- name: mutant\nrepo_uri: 'https://github.com/mbj/mutant.git'\n- repo_ref: 'origin/main'\n+ repo_ref: '83f8b26e'\nexclude: []\n- name: rubyspec\nrepo_uri: 'https://github.com/ruby/spec.git'\n" }, { "change_type": "MODIFY", "old_path": "spec/unit/unparser_spec.rb", "new_path": "spec/unit/unparser_spec.rb", "diff": "@@ -359,6 +359,14 @@ describe Unparser, mutant_expression: 'Unparser*' do\nlet(:version_excludes) do\nexcludes = []\n+ if RUBY_VERSION < '3.1.'\n+ excludes.concat(\n+ %w[\n+ test/corpus/literal/since/31.rb\n+ ]\n+ )\n+ end\n+\nif RUBY_VERSION < '3.0.'\nexcludes.concat(\n%w[\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/corpus/literal/since/31.rb", "diff": "+def foo(&)\n+ bar(&)\n+end\n+\n+def foo(a, &)\n+ bar(&)\n+end\n" }, { "change_type": "MODIFY", "old_path": "unparser.gemspec", "new_path": "unparser.gemspec", "diff": "Gem::Specification.new do |gem|\ngem.name = 'unparser'\n- gem.version = '0.6.3'\n+ gem.version = '0.6.4'\ngem.authors = ['Markus Schirp']\ngem.email = 'mbj@schirp-dso.com'\n" } ]
Ruby
MIT License
mbj/unparser
Add 3.1 syntax support
398,795
14.02.2022 00:55:19
0
8678ae7bb8ef754a919def6ee81e42ec1f8f2a9e
Change to depend on mutant-0.11.4
[ { "change_type": "MODIFY", "old_path": "Gemfile", "new_path": "Gemfile", "diff": "@@ -4,8 +4,6 @@ source 'https://rubygems.org'\ngemspec\n-gem 'mutant', git: 'https://github.com/mbj/mutant', ref: '2fbc9dc7f8a8d363bc9fad6a32b0a6c9d1032743'\n-\nsource 'https://oss:Px2ENN7S91OmWaD5G7MIQJi1dmtmYrEh@gem.mutant.dev' do\ngem 'mutant-license'\nend\n" }, { "change_type": "MODIFY", "old_path": "Gemfile.lock", "new_path": "Gemfile.lock", "diff": "-GIT\n- remote: https://github.com/mbj/mutant\n- revision: 2fbc9dc7f8a8d363bc9fad6a32b0a6c9d1032743\n- ref: 2fbc9dc7f8a8d363bc9fad6a32b0a6c9d1032743\n- specs:\n- mutant (0.11.2)\n- diff-lcs (~> 1.3)\n- parser (~> 3.1.0)\n- regexp_parser (~> 2.0, >= 2.0.3)\n- sorbet-runtime (~> 0.5.0)\n- unparser (~> 0.6.2)\n-\nPATH\nremote: .\nspecs:\n@@ -27,8 +15,14 @@ GEM\nspecs:\nast (2.4.2)\ndiff-lcs (1.5.0)\n- mutant-rspec (0.11.2)\n- mutant (= 0.11.2)\n+ mutant (0.11.4)\n+ diff-lcs (~> 1.3)\n+ parser (~> 3.1.0)\n+ regexp_parser (~> 2.0, >= 2.0.3)\n+ sorbet-runtime (~> 0.5.0)\n+ unparser (~> 0.6.4)\n+ mutant-rspec (0.11.4)\n+ mutant (= 0.11.4)\nrspec-core (>= 3.8.0, < 4.0.0)\nparallel (1.21.0)\nparser (3.1.0.0)\n@@ -66,16 +60,16 @@ GEM\nrubocop-packaging (0.5.1)\nrubocop (>= 0.89, < 2.0)\nruby-progressbar (1.11.0)\n- sorbet-runtime (0.5.9531)\n+ sorbet-runtime (0.5.9636)\nunicode-display_width (2.1.0)\nPLATFORMS\nruby\nDEPENDENCIES\n- mutant!\n+ mutant (~> 0.11.4)\nmutant-license!\n- mutant-rspec (~> 0.11.1)\n+ mutant-rspec (~> 0.11.4)\nrspec (~> 3.9)\nrspec-core (~> 3.9)\nrspec-its (~> 1.3.0)\n" }, { "change_type": "MODIFY", "old_path": "spec/integrations.yml", "new_path": "spec/integrations.yml", "diff": "---\n- name: mutant\nrepo_uri: 'https://github.com/mbj/mutant.git'\n- repo_ref: '83f8b26e'\n+ repo_ref: 'main'\nexclude: []\n- name: rubyspec\nrepo_uri: 'https://github.com/ruby/spec.git'\n" }, { "change_type": "MODIFY", "old_path": "unparser.gemspec", "new_path": "unparser.gemspec", "diff": "@@ -26,8 +26,8 @@ Gem::Specification.new do |gem|\ngem.add_dependency('diff-lcs', '~> 1.3')\ngem.add_dependency('parser', '>= 3.1.0')\n- gem.add_development_dependency('mutant', '~> 0.11.1')\n- gem.add_development_dependency('mutant-rspec', '~> 0.11.1')\n+ gem.add_development_dependency('mutant', '~> 0.11.4')\n+ gem.add_development_dependency('mutant-rspec', '~> 0.11.4')\ngem.add_development_dependency('rspec', '~> 3.9')\ngem.add_development_dependency('rspec-core', '~> 3.9')\ngem.add_development_dependency('rspec-its', '~> 1.3.0')\n" } ]
Ruby
MIT License
mbj/unparser
Change to depend on mutant-0.11.4
398,795
18.04.2022 03:01:09
0
ba8a67372c1c498503092006f9c189bf5c687a2f
Fix heredoc block with arguments [Fix
[ { "change_type": "MODIFY", "old_path": "Changelog.md", "new_path": "Changelog.md", "diff": "+# v0.6.5 2022-04-17\n+\n+[#312](https://github.com/mbj/unparser/pull/122)\n+\n+* Fix #311, emitting of heredocs within block that has arguments.\n+\n+[#313](https://github.com/mbj/unparser/pull/123)\n+\n+* Remove Ruby-2.6 support as its EOL\n+\n# v0.6.4 2022-02-12\n[#299](https://github.com/mbj/unparser/pull/299)\n" }, { "change_type": "MODIFY", "old_path": "Gemfile.lock", "new_path": "Gemfile.lock", "diff": "PATH\nremote: .\nspecs:\n- unparser (0.6.4)\n+ unparser (0.6.5)\ndiff-lcs (~> 1.3)\nparser (>= 3.1.0)\n" }, { "change_type": "MODIFY", "old_path": "lib/unparser/emitter/block.rb", "new_path": "lib/unparser/emitter/block.rb", "diff": "@@ -15,8 +15,8 @@ module Unparser\nemit_target\nws\nwrite_open\n- target_writer.emit_heredoc_reminders if n_send?(target)\nemit_block_arguments unless n_lambda?(target)\n+ target_writer.emit_heredoc_reminders if n_send?(target)\nemit_optional_body_ensure_rescue(body)\nwrite_close\nend\n" }, { "change_type": "MODIFY", "old_path": "test/corpus/literal/dstr.rb", "new_path": "test/corpus/literal/dstr.rb", "diff": "@@ -28,3 +28,10 @@ if true\n#{42}\nHEREDOC\nend\n+foo(<<-HEREDOC)\n+ #{bar}\n+HEREDOC\n+foo(<<-HEREDOC) { |x|\n+ #{bar}\n+HEREDOC\n+}\n" }, { "change_type": "MODIFY", "old_path": "unparser.gemspec", "new_path": "unparser.gemspec", "diff": "Gem::Specification.new do |gem|\ngem.name = 'unparser'\n- gem.version = '0.6.4'\n+ gem.version = '0.6.5'\ngem.authors = ['Markus Schirp']\ngem.email = 'mbj@schirp-dso.com'\n" } ]
Ruby
MIT License
mbj/unparser
Fix heredoc block with arguments [Fix #311]
398,795
18.04.2022 03:06:43
0
ae3d5d411233e2453ce22443db8119d6915776d3
Remove Ruby-2.6 support
[ { "change_type": "MODIFY", "old_path": ".github/workflows/ci.yml", "new_path": ".github/workflows/ci.yml", "diff": "@@ -20,7 +20,7 @@ jobs:\nstrategy:\nfail-fast: false\nmatrix:\n- ruby: [ruby-2.6, ruby-2.7, ruby-3.0, ruby-3.1]\n+ ruby: [ruby-2.7, ruby-3.0, ruby-3.1]\nos: [ubuntu-latest]\nsteps:\n- uses: actions/checkout@v2\n@@ -36,7 +36,7 @@ jobs:\nstrategy:\nfail-fast: false\nmatrix:\n- ruby: [ruby-2.6, ruby-2.7, ruby-3.0, ruby-3.1]\n+ ruby: [ruby-2.7, ruby-3.0, ruby-3.1]\nos: [macos-latest, ubuntu-latest]\nsteps:\n- uses: actions/checkout@v2\n@@ -54,7 +54,7 @@ jobs:\nstrategy:\nfail-fast: false\nmatrix:\n- ruby: [ruby-2.6, ruby-2.7, ruby-3.0, ruby-3.1]\n+ ruby: [ruby-2.7, ruby-3.0, ruby-3.1]\nos: [macos-latest, ubuntu-latest]\nsteps:\n- uses: actions/checkout@v2\n@@ -70,7 +70,7 @@ jobs:\nstrategy:\nfail-fast: false\nmatrix:\n- ruby: [ruby-2.6, ruby-2.7, ruby-3.0, ruby-3.1]\n+ ruby: [ruby-2.7, ruby-3.0, ruby-3.1]\nos: [macos-latest, ubuntu-latest]\nsteps:\n- uses: actions/checkout@v2\n@@ -86,7 +86,7 @@ jobs:\nstrategy:\nfail-fast: false\nmatrix:\n- ruby: [ruby-2.6, ruby-2.7, ruby-3.0, ruby-3.1]\n+ ruby: [ruby-2.7, ruby-3.0, ruby-3.1]\nos: [macos-latest, ubuntu-latest]\nsteps:\n- uses: actions/checkout@v2\n" }, { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -10,7 +10,7 @@ The following constraints apply:\n* No support for macruby extensions\n* Only support for the [modern AST](https://github.com/whitequark/parser/#usage) format\n-* Only support for Ruby >= 2.6\n+* Only support for Ruby >= 2.7\nNotable Users:\n" }, { "change_type": "MODIFY", "old_path": "spec/unit/unparser_spec.rb", "new_path": "spec/unit/unparser_spec.rb", "diff": "@@ -384,10 +384,6 @@ describe Unparser, mutant_expression: 'Unparser*' do\n)\nend\n- if RUBY_VERSION < '2.6.'\n- excludes << 'test/corpus/literal/since/26.rb'\n- end\n-\nexcludes.flat_map { |file| ['--ignore', file] }\nend\n" }, { "change_type": "RENAME", "old_path": "test/corpus/literal/since/26.rb", "new_path": "test/corpus/literal/range.rb", "diff": "" }, { "change_type": "MODIFY", "old_path": "unparser.gemspec", "new_path": "unparser.gemspec", "diff": "@@ -21,7 +21,7 @@ Gem::Specification.new do |gem|\ngem.extra_rdoc_files = %w[README.md]\ngem.executables = %w[unparser]\n- gem.required_ruby_version = '>= 2.6'\n+ gem.required_ruby_version = '>= 2.7'\ngem.add_dependency('diff-lcs', '~> 1.3')\ngem.add_dependency('parser', '>= 3.1.0')\n" } ]
Ruby
MIT License
mbj/unparser
Remove Ruby-2.6 support
398,794
21.07.2022 10:37:16
-3,600
6081edf874be22ef2687a2e15eeef7c774eb1aec
Add Known Users section to Readme.md
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -191,6 +191,11 @@ Contributing\n(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)\n* Send me a pull request. Bonus points for topic branches.\n+Known Users\n+-------------\n+\n+* [RailsRocket](https://www.railsrocket.app) - A no-code app builder that creates Rails apps\n+\nLicense\n-------\n" } ]
Ruby
MIT License
mbj/unparser
Add Known Users section to Readme.md
398,795
07.01.2023 00:17:20
0
45675cd1e3efe8e992d8d17c6b4c145a80d92786
Remove obsolete Rakefile
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -187,7 +187,7 @@ Contributing\n* Make your feature addition or bug fix.\n* Add tests for it. This is important so I don't break it in a\nfuture version unintentionally.\n-* Commit, do not mess with Rakefile or version\n+* Commit, do not mess with version\n(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)\n* Send me a pull request. Bonus points for topic branches.\n" }, { "change_type": "DELETE", "old_path": "Rakefile", "new_path": null, "diff": "-require 'devtools'\n-Devtools.init_rake_tasks\n-\n-Rake.application.load_imports\n-task('metrics:mutant').clear\n-\n-namespace :metrics do\n- task mutant: :coverage do\n- args = %w[\n- bundle exec mutant\n- --ignore-subject Unparser::Buffer#initialize\n- --include lib\n- --require unparser\n- --use rspec\n- --zombie\n- --since HEAD~1\n- ]\n- args.concat(%w[--jobs 4]) if ENV.key?('CIRCLECI')\n-\n- system(*args.concat(%w[-- Unparser*])) or fail \"Mutant task failed\"\n- end\n-end\n" } ]
Ruby
MIT License
mbj/unparser
Remove obsolete Rakefile
398,795
08.01.2023 15:37:46
0
dcf067707e09752c8cc086025d5808cfc55e1102
Upgrade to mutant-0.11.18
[ { "change_type": "MODIFY", "old_path": "Gemfile", "new_path": "Gemfile", "diff": "@@ -4,8 +4,6 @@ source 'https://rubygems.org'\ngemspec\n-gem 'mutant', git: 'https://github.com/mbj/mutant', branch: 'add/ruby-3.2'\n-\nsource 'https://oss:Px2ENN7S91OmWaD5G7MIQJi1dmtmYrEh@gem.mutant.dev' do\ngem 'mutant-license'\nend\n" }, { "change_type": "MODIFY", "old_path": "Gemfile.lock", "new_path": "Gemfile.lock", "diff": "-GIT\n- remote: https://github.com/mbj/mutant\n- revision: 6dbea24f122a06122c8ef2c0941ddcad70984265\n- branch: add/ruby-3.2\n- specs:\n- mutant (0.11.17)\n- diff-lcs (~> 1.3)\n- parser (~> 3.2.0)\n- regexp_parser (~> 2.6.1)\n- sorbet-runtime (~> 0.5.0)\n- unparser (~> 0.6.5)\n-\nPATH\nremote: .\nspecs:\n@@ -28,8 +16,14 @@ GEM\nast (2.4.2)\ndiff-lcs (1.5.0)\njson (2.6.3)\n- mutant-rspec (0.11.17)\n- mutant (= 0.11.17)\n+ mutant (0.11.18)\n+ diff-lcs (~> 1.3)\n+ parser (~> 3.2.0)\n+ regexp_parser (~> 2.6.1)\n+ sorbet-runtime (~> 0.5.0)\n+ unparser (~> 0.6.6)\n+ mutant-rspec (0.11.18)\n+ mutant (= 0.11.18)\nrspec-core (>= 3.8.0, < 4.0.0)\nparallel (1.22.1)\nparser (3.2.0.0)\n@@ -43,13 +37,13 @@ GEM\nrspec-mocks (~> 3.12.0)\nrspec-core (3.12.0)\nrspec-support (~> 3.12.0)\n- rspec-expectations (3.12.1)\n+ rspec-expectations (3.12.2)\ndiff-lcs (>= 1.2.0, < 2.0)\nrspec-support (~> 3.12.0)\nrspec-its (1.3.0)\nrspec-core (>= 3.0.0)\nrspec-expectations (>= 3.0.0)\n- rspec-mocks (3.12.1)\n+ rspec-mocks (3.12.2)\ndiff-lcs (>= 1.2.0, < 2.0)\nrspec-support (~> 3.12.0)\nrspec-support (3.12.0)\n@@ -68,16 +62,16 @@ GEM\nrubocop-packaging (0.5.2)\nrubocop (>= 1.33, < 2.0)\nruby-progressbar (1.11.0)\n- sorbet-runtime (0.5.10607)\n+ sorbet-runtime (0.5.10611)\nunicode-display_width (2.4.2)\nPLATFORMS\nruby\nDEPENDENCIES\n- mutant!\n+ mutant (~> 0.11.18)\nmutant-license!\n- mutant-rspec (~> 0.11.17)\n+ mutant-rspec (~> 0.11.18)\nrspec (~> 3.9)\nrspec-core (~> 3.9)\nrspec-its (~> 1.3.0)\n" }, { "change_type": "MODIFY", "old_path": "unparser.gemspec", "new_path": "unparser.gemspec", "diff": "@@ -26,8 +26,8 @@ Gem::Specification.new do |gem|\ngem.add_dependency('diff-lcs', '~> 1.3')\ngem.add_dependency('parser', '>= 3.2.0')\n- gem.add_development_dependency('mutant', '~> 0.11.17')\n- gem.add_development_dependency('mutant-rspec', '~> 0.11.17')\n+ gem.add_development_dependency('mutant', '~> 0.11.18')\n+ gem.add_development_dependency('mutant-rspec', '~> 0.11.18')\ngem.add_development_dependency('rspec', '~> 3.9')\ngem.add_development_dependency('rspec-core', '~> 3.9')\ngem.add_development_dependency('rspec-its', '~> 1.3.0')\n" } ]
Ruby
MIT License
mbj/unparser
Upgrade to mutant-0.11.18
398,795
08.01.2023 15:37:48
0
a9bcf565aec8248d35a08041427d0fde5226f0c2
Change to v3 checkout action
[ { "change_type": "MODIFY", "old_path": ".github/workflows/ci.yml", "new_path": ".github/workflows/ci.yml", "diff": "@@ -7,7 +7,7 @@ jobs:\nname: Base steps\nruns-on: ubuntu-latest\nsteps:\n- - uses: actions/checkout@v2\n+ - uses: actions/checkout@v3\n- name: Check Whitespace\nrun: git diff --check -- HEAD~1\nruby-unit-spec:\n@@ -20,7 +20,7 @@ jobs:\nruby: [ruby-2.7, ruby-3.0, ruby-3.1, ruby-3.2]\nos: [ubuntu-latest]\nsteps:\n- - uses: actions/checkout@v2\n+ - uses: actions/checkout@v3\n- uses: ruby/setup-ruby@v1\nwith:\nbundler-cache: true\n@@ -36,7 +36,7 @@ jobs:\nruby: [ruby-2.7, ruby-3.0, ruby-3.1, ruby-3.2]\nos: [macos-latest, ubuntu-latest]\nsteps:\n- - uses: actions/checkout@v2\n+ - uses: actions/checkout@v3\nwith:\nfetch-depth: 0\n- uses: ruby/setup-ruby@v1\n@@ -54,7 +54,7 @@ jobs:\nruby: [ruby-2.7, ruby-3.0, ruby-3.1, ruby-3.2]\nos: [macos-latest, ubuntu-latest]\nsteps:\n- - uses: actions/checkout@v2\n+ - uses: actions/checkout@v3\n- uses: ruby/setup-ruby@v1\nwith:\nbundler-cache: true\n@@ -70,7 +70,7 @@ jobs:\nruby: [ruby-2.7, ruby-3.0, ruby-3.1, ruby-3.2]\nos: [macos-latest, ubuntu-latest]\nsteps:\n- - uses: actions/checkout@v2\n+ - uses: actions/checkout@v3\n- uses: ruby/setup-ruby@v1\nwith:\nbundler-cache: true\n@@ -86,7 +86,7 @@ jobs:\nruby: [ruby-2.7, ruby-3.0, ruby-3.1, ruby-3.2]\nos: [macos-latest, ubuntu-latest]\nsteps:\n- - uses: actions/checkout@v2\n+ - uses: actions/checkout@v3\n- uses: ruby/setup-ruby@v1\nwith:\nbundler-cache: true\n" } ]
Ruby
MIT License
mbj/unparser
Change to v3 checkout action
398,795
08.01.2023 15:37:49
0
b48e9f67e7d4a49db40d67be17c0f0ad5568ca9e
Add required rubygems MFA
[ { "change_type": "MODIFY", "old_path": "Changelog.md", "new_path": "Changelog.md", "diff": "# v0.6.6 2022-04-17\n+[#338](https://github.com/mbj/unparser/pull/338)\n+\n+* Add required MFA for rubygems pushes.\n+\n+# v0.6.6 2022-04-17\n+\n[#336](https://github.com/mbj/unparser/pull/336)\n* Add support for ruby-3.2 syntax.\n" }, { "change_type": "MODIFY", "old_path": "Gemfile.lock", "new_path": "Gemfile.lock", "diff": "PATH\nremote: .\nspecs:\n- unparser (0.6.6)\n+ unparser (0.6.7)\ndiff-lcs (~> 1.3)\nparser (>= 3.2.0)\n" }, { "change_type": "MODIFY", "old_path": "unparser.gemspec", "new_path": "unparser.gemspec", "diff": "Gem::Specification.new do |gem|\ngem.name = 'unparser'\n- gem.version = '0.6.6'\n+ gem.version = '0.6.7'\ngem.authors = ['Markus Schirp']\ngem.email = 'mbj@schirp-dso.com'\n@@ -21,6 +21,8 @@ Gem::Specification.new do |gem|\ngem.extra_rdoc_files = %w[README.md]\ngem.executables = %w[unparser]\n+ gem.metadata['rubygems_mfa_required'] = 'true'\n+\ngem.required_ruby_version = '>= 2.7'\ngem.add_dependency('diff-lcs', '~> 1.3')\n" } ]
Ruby
MIT License
mbj/unparser
Add required rubygems MFA
95,144
09.09.2018 11:19:07
-7,200
ef808a8f239cb85d81a6e2aaa27c9547eb0939fb
Rename `App\` to `Bolt\`
[ { "change_type": "MODIFY", "old_path": "bin/console", "new_path": "bin/console", "diff": "#!/usr/bin/env php\n<?php\n-use App\\Kernel;\n+use Bolt\\Kernel;\nuse Symfony\\Bundle\\FrameworkBundle\\Console\\Application;\nuse Symfony\\Component\\Console\\Input\\ArgvInput;\nuse Symfony\\Component\\Debug\\Debug;\n" }, { "change_type": "MODIFY", "old_path": "composer.json", "new_path": "composer.json", "diff": "},\n\"autoload\": {\n\"psr-4\": {\n- \"App\\\\\": \"src/\"\n+ \"Bolt\\\\\": \"src/\"\n}\n},\n\"autoload-dev\": {\n" }, { "change_type": "MODIFY", "old_path": "composer.lock", "new_path": "composer.lock", "diff": "},\n{\n\"name\": \"doctrine/persistence\",\n- \"version\": \"v1.0.0\",\n+ \"version\": \"v1.0.1\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/doctrine/persistence.git\",\n- \"reference\": \"17896f6d56a2794a1619e019596ae627aabd8fd5\"\n+ \"reference\": \"af1ec238659a83e320f03e0e454e200f689b4b97\"\n},\n\"dist\": {\n\"type\": \"zip\",\n- \"url\": \"https://api.github.com/repos/doctrine/persistence/zipball/17896f6d56a2794a1619e019596ae627aabd8fd5\",\n- \"reference\": \"17896f6d56a2794a1619e019596ae627aabd8fd5\",\n+ \"url\": \"https://api.github.com/repos/doctrine/persistence/zipball/af1ec238659a83e320f03e0e454e200f689b4b97\",\n+ \"reference\": \"af1ec238659a83e320f03e0e454e200f689b4b97\",\n\"shasum\": \"\"\n},\n\"require\": {\n\"keywords\": [\n\"persistence\"\n],\n- \"time\": \"2018-06-14T18:57:48+00:00\"\n+ \"time\": \"2018-07-12T12:37:50+00:00\"\n},\n{\n\"name\": \"doctrine/reflection\",\n},\n{\n\"name\": \"ocramius/proxy-manager\",\n- \"version\": \"2.2.0\",\n+ \"version\": \"2.2.1\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/Ocramius/ProxyManager.git\",\n- \"reference\": \"81d53b2878f1d1c40ad27270e64b51798485dfc5\"\n+ \"reference\": \"306da837ddf12aa5a85a8ca343587ec822802ac3\"\n},\n\"dist\": {\n\"type\": \"zip\",\n- \"url\": \"https://api.github.com/repos/Ocramius/ProxyManager/zipball/81d53b2878f1d1c40ad27270e64b51798485dfc5\",\n- \"reference\": \"81d53b2878f1d1c40ad27270e64b51798485dfc5\",\n+ \"url\": \"https://api.github.com/repos/Ocramius/ProxyManager/zipball/306da837ddf12aa5a85a8ca343587ec822802ac3\",\n+ \"reference\": \"306da837ddf12aa5a85a8ca343587ec822802ac3\",\n\"shasum\": \"\"\n},\n\"require\": {\n\"proxy pattern\",\n\"service proxies\"\n],\n- \"time\": \"2017-11-16T23:22:31+00:00\"\n+ \"time\": \"2018-08-26T15:07:25+00:00\"\n},\n{\n\"name\": \"psr/cache\",\n},\n{\n\"name\": \"symfony/asset\",\n- \"version\": \"v4.1.3\",\n+ \"version\": \"v4.1.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/asset.git\",\n},\n{\n\"name\": \"symfony/cache\",\n- \"version\": \"v4.1.3\",\n+ \"version\": \"v4.1.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/cache.git\",\n- \"reference\": \"c666a5bbfeb1fe05c7b91d46810f405c8bea14cf\"\n+ \"reference\": \"b8440ff4635c6631aca21a09ab72e0b7e3a6cb7a\"\n},\n\"dist\": {\n\"type\": \"zip\",\n- \"url\": \"https://api.github.com/repos/symfony/cache/zipball/c666a5bbfeb1fe05c7b91d46810f405c8bea14cf\",\n- \"reference\": \"c666a5bbfeb1fe05c7b91d46810f405c8bea14cf\",\n+ \"url\": \"https://api.github.com/repos/symfony/cache/zipball/b8440ff4635c6631aca21a09ab72e0b7e3a6cb7a\",\n+ \"reference\": \"b8440ff4635c6631aca21a09ab72e0b7e3a6cb7a\",\n\"shasum\": \"\"\n},\n\"require\": {\n\"caching\",\n\"psr6\"\n],\n- \"time\": \"2018-07-26T11:24:31+00:00\"\n+ \"time\": \"2018-08-27T09:36:56+00:00\"\n},\n{\n\"name\": \"symfony/config\",\n- \"version\": \"v4.1.3\",\n+ \"version\": \"v4.1.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/config.git\",\n- \"reference\": \"c868972ac26e4e19860ce11b300bb74145246ff9\"\n+ \"reference\": \"76015a3cc372b14d00040ff58e18e29f69eba717\"\n},\n\"dist\": {\n\"type\": \"zip\",\n- \"url\": \"https://api.github.com/repos/symfony/config/zipball/c868972ac26e4e19860ce11b300bb74145246ff9\",\n- \"reference\": \"c868972ac26e4e19860ce11b300bb74145246ff9\",\n+ \"url\": \"https://api.github.com/repos/symfony/config/zipball/76015a3cc372b14d00040ff58e18e29f69eba717\",\n+ \"reference\": \"76015a3cc372b14d00040ff58e18e29f69eba717\",\n\"shasum\": \"\"\n},\n\"require\": {\n],\n\"description\": \"Symfony Config Component\",\n\"homepage\": \"https://symfony.com\",\n- \"time\": \"2018-07-26T11:24:31+00:00\"\n+ \"time\": \"2018-08-08T06:37:38+00:00\"\n},\n{\n\"name\": \"symfony/console\",\n- \"version\": \"v4.1.3\",\n+ \"version\": \"v4.1.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/console.git\",\n},\n{\n\"name\": \"symfony/debug\",\n- \"version\": \"v4.1.3\",\n+ \"version\": \"v4.1.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/debug.git\",\n- \"reference\": \"9316545571f079c4dd183e674721d9dc783ce196\"\n+ \"reference\": \"47ead688f1f2877f3f14219670f52e4722ee7052\"\n},\n\"dist\": {\n\"type\": \"zip\",\n- \"url\": \"https://api.github.com/repos/symfony/debug/zipball/9316545571f079c4dd183e674721d9dc783ce196\",\n- \"reference\": \"9316545571f079c4dd183e674721d9dc783ce196\",\n+ \"url\": \"https://api.github.com/repos/symfony/debug/zipball/47ead688f1f2877f3f14219670f52e4722ee7052\",\n+ \"reference\": \"47ead688f1f2877f3f14219670f52e4722ee7052\",\n\"shasum\": \"\"\n},\n\"require\": {\n],\n\"description\": \"Symfony Debug Component\",\n\"homepage\": \"https://symfony.com\",\n- \"time\": \"2018-07-26T11:24:31+00:00\"\n+ \"time\": \"2018-08-03T11:13:38+00:00\"\n},\n{\n\"name\": \"symfony/debug-bundle\",\n- \"version\": \"v4.1.3\",\n+ \"version\": \"v4.1.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/debug-bundle.git\",\n},\n{\n\"name\": \"symfony/dependency-injection\",\n- \"version\": \"v4.1.3\",\n+ \"version\": \"v4.1.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/dependency-injection.git\",\n- \"reference\": \"f4f401fc2766eb8d766fc6043d9e6489b37a41e4\"\n+ \"reference\": \"bae4983003c9d451e278504d7d9b9d7fc1846873\"\n},\n\"dist\": {\n\"type\": \"zip\",\n- \"url\": \"https://api.github.com/repos/symfony/dependency-injection/zipball/f4f401fc2766eb8d766fc6043d9e6489b37a41e4\",\n- \"reference\": \"f4f401fc2766eb8d766fc6043d9e6489b37a41e4\",\n+ \"url\": \"https://api.github.com/repos/symfony/dependency-injection/zipball/bae4983003c9d451e278504d7d9b9d7fc1846873\",\n+ \"reference\": \"bae4983003c9d451e278504d7d9b9d7fc1846873\",\n\"shasum\": \"\"\n},\n\"require\": {\n],\n\"description\": \"Symfony DependencyInjection Component\",\n\"homepage\": \"https://symfony.com\",\n- \"time\": \"2018-08-01T08:24:03+00:00\"\n+ \"time\": \"2018-08-08T11:48:58+00:00\"\n},\n{\n\"name\": \"symfony/doctrine-bridge\",\n- \"version\": \"v4.1.3\",\n+ \"version\": \"v4.1.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/doctrine-bridge.git\",\n- \"reference\": \"3ecf9bddd49f6cd3a1088babf5db5c67aa05f27e\"\n+ \"reference\": \"58e331b3f6bbbd0beeb41cc924455bf85f660f50\"\n},\n\"dist\": {\n\"type\": \"zip\",\n- \"url\": \"https://api.github.com/repos/symfony/doctrine-bridge/zipball/3ecf9bddd49f6cd3a1088babf5db5c67aa05f27e\",\n- \"reference\": \"3ecf9bddd49f6cd3a1088babf5db5c67aa05f27e\",\n+ \"url\": \"https://api.github.com/repos/symfony/doctrine-bridge/zipball/58e331b3f6bbbd0beeb41cc924455bf85f660f50\",\n+ \"reference\": \"58e331b3f6bbbd0beeb41cc924455bf85f660f50\",\n\"shasum\": \"\"\n},\n\"require\": {\n- \"doctrine/common\": \"~2.4@stable\",\n+ \"doctrine/common\": \"~2.4\",\n\"php\": \"^7.1.3\",\n\"symfony/polyfill-ctype\": \"~1.8\",\n\"symfony/polyfill-mbstring\": \"~1.0\"\n],\n\"description\": \"Symfony Doctrine Bridge\",\n\"homepage\": \"https://symfony.com\",\n- \"time\": \"2018-07-26T11:24:31+00:00\"\n+ \"time\": \"2018-08-24T10:22:26+00:00\"\n},\n{\n\"name\": \"symfony/event-dispatcher\",\n- \"version\": \"v4.1.3\",\n+ \"version\": \"v4.1.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/event-dispatcher.git\",\n},\n{\n\"name\": \"symfony/filesystem\",\n- \"version\": \"v4.1.3\",\n+ \"version\": \"v4.1.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/filesystem.git\",\n- \"reference\": \"2e30335e0aafeaa86645555959572fe7cea22b43\"\n+ \"reference\": \"c0f5f62db218fa72195b8b8700e4b9b9cf52eb5e\"\n},\n\"dist\": {\n\"type\": \"zip\",\n- \"url\": \"https://api.github.com/repos/symfony/filesystem/zipball/2e30335e0aafeaa86645555959572fe7cea22b43\",\n- \"reference\": \"2e30335e0aafeaa86645555959572fe7cea22b43\",\n+ \"url\": \"https://api.github.com/repos/symfony/filesystem/zipball/c0f5f62db218fa72195b8b8700e4b9b9cf52eb5e\",\n+ \"reference\": \"c0f5f62db218fa72195b8b8700e4b9b9cf52eb5e\",\n\"shasum\": \"\"\n},\n\"require\": {\n],\n\"description\": \"Symfony Filesystem Component\",\n\"homepage\": \"https://symfony.com\",\n- \"time\": \"2018-07-26T11:24:31+00:00\"\n+ \"time\": \"2018-08-18T16:52:46+00:00\"\n},\n{\n\"name\": \"symfony/finder\",\n- \"version\": \"v4.1.3\",\n+ \"version\": \"v4.1.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/finder.git\",\n},\n{\n\"name\": \"symfony/flex\",\n- \"version\": \"v1.1.0\",\n+ \"version\": \"v1.1.1\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/flex.git\",\n- \"reference\": \"d6f5fed47ddad2eb25d5cc19316692203a2898eb\"\n+ \"reference\": \"9fb60f232af0764d58002e7872acb43a74506d25\"\n},\n\"dist\": {\n\"type\": \"zip\",\n- \"url\": \"https://api.github.com/repos/symfony/flex/zipball/d6f5fed47ddad2eb25d5cc19316692203a2898eb\",\n- \"reference\": \"d6f5fed47ddad2eb25d5cc19316692203a2898eb\",\n+ \"url\": \"https://api.github.com/repos/symfony/flex/zipball/9fb60f232af0764d58002e7872acb43a74506d25\",\n+ \"reference\": \"9fb60f232af0764d58002e7872acb43a74506d25\",\n\"shasum\": \"\"\n},\n\"require\": {\n}\n],\n\"description\": \"Composer plugin for Symfony\",\n- \"time\": \"2018-08-21T07:51:18+00:00\"\n+ \"time\": \"2018-09-03T08:17:12+00:00\"\n},\n{\n\"name\": \"symfony/framework-bundle\",\n- \"version\": \"v4.1.3\",\n+ \"version\": \"v4.1.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/framework-bundle.git\",\n- \"reference\": \"ad1ac510d8c89557b8afa2dd838e2f34b4c2529c\"\n+ \"reference\": \"f62dc69959253acf717c3d89cd509975daf10e02\"\n},\n\"dist\": {\n\"type\": \"zip\",\n- \"url\": \"https://api.github.com/repos/symfony/framework-bundle/zipball/ad1ac510d8c89557b8afa2dd838e2f34b4c2529c\",\n- \"reference\": \"ad1ac510d8c89557b8afa2dd838e2f34b4c2529c\",\n+ \"url\": \"https://api.github.com/repos/symfony/framework-bundle/zipball/f62dc69959253acf717c3d89cd509975daf10e02\",\n+ \"reference\": \"f62dc69959253acf717c3d89cd509975daf10e02\",\n\"shasum\": \"\"\n},\n\"require\": {\n],\n\"description\": \"Symfony FrameworkBundle\",\n\"homepage\": \"https://symfony.com\",\n- \"time\": \"2018-08-01T08:24:03+00:00\"\n+ \"time\": \"2018-08-17T12:07:19+00:00\"\n},\n{\n\"name\": \"symfony/http-foundation\",\n- \"version\": \"v4.1.3\",\n+ \"version\": \"v4.1.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/http-foundation.git\",\n- \"reference\": \"7d93e3547660ec7ee3dad1428ba42e8076a0e5f1\"\n+ \"reference\": \"3a5c91e133b220bb882b3cd773ba91bf39989345\"\n},\n\"dist\": {\n\"type\": \"zip\",\n- \"url\": \"https://api.github.com/repos/symfony/http-foundation/zipball/7d93e3547660ec7ee3dad1428ba42e8076a0e5f1\",\n- \"reference\": \"7d93e3547660ec7ee3dad1428ba42e8076a0e5f1\",\n+ \"url\": \"https://api.github.com/repos/symfony/http-foundation/zipball/3a5c91e133b220bb882b3cd773ba91bf39989345\",\n+ \"reference\": \"3a5c91e133b220bb882b3cd773ba91bf39989345\",\n\"shasum\": \"\"\n},\n\"require\": {\n],\n\"description\": \"Symfony HttpFoundation Component\",\n\"homepage\": \"https://symfony.com\",\n- \"time\": \"2018-08-01T14:07:44+00:00\"\n+ \"time\": \"2018-08-27T17:47:02+00:00\"\n},\n{\n\"name\": \"symfony/http-kernel\",\n- \"version\": \"v4.1.3\",\n+ \"version\": \"v4.1.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/http-kernel.git\",\n- \"reference\": \"6347be5110efb27fe45ea04bf213078b67a05036\"\n+ \"reference\": \"33de0a1ff2e1720096189e3ced682d7a4e8f5e35\"\n},\n\"dist\": {\n\"type\": \"zip\",\n- \"url\": \"https://api.github.com/repos/symfony/http-kernel/zipball/6347be5110efb27fe45ea04bf213078b67a05036\",\n- \"reference\": \"6347be5110efb27fe45ea04bf213078b67a05036\",\n+ \"url\": \"https://api.github.com/repos/symfony/http-kernel/zipball/33de0a1ff2e1720096189e3ced682d7a4e8f5e35\",\n+ \"reference\": \"33de0a1ff2e1720096189e3ced682d7a4e8f5e35\",\n\"shasum\": \"\"\n},\n\"require\": {\n],\n\"description\": \"Symfony HttpKernel Component\",\n\"homepage\": \"https://symfony.com\",\n- \"time\": \"2018-08-01T15:30:34+00:00\"\n+ \"time\": \"2018-08-28T06:17:42+00:00\"\n},\n{\n\"name\": \"symfony/lts\",\n},\n{\n\"name\": \"symfony/monolog-bridge\",\n- \"version\": \"v4.1.3\",\n+ \"version\": \"v4.1.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/monolog-bridge.git\",\n},\n{\n\"name\": \"symfony/routing\",\n- \"version\": \"v4.1.3\",\n+ \"version\": \"v4.1.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/routing.git\",\n- \"reference\": \"6912cfebc0ea4e7a46fdd15c9bd1f427dd39ff1b\"\n+ \"reference\": \"a5784c2ec4168018c87b38f0e4f39d2278499f51\"\n},\n\"dist\": {\n\"type\": \"zip\",\n- \"url\": \"https://api.github.com/repos/symfony/routing/zipball/6912cfebc0ea4e7a46fdd15c9bd1f427dd39ff1b\",\n- \"reference\": \"6912cfebc0ea4e7a46fdd15c9bd1f427dd39ff1b\",\n+ \"url\": \"https://api.github.com/repos/symfony/routing/zipball/a5784c2ec4168018c87b38f0e4f39d2278499f51\",\n+ \"reference\": \"a5784c2ec4168018c87b38f0e4f39d2278499f51\",\n\"shasum\": \"\"\n},\n\"require\": {\n\"uri\",\n\"url\"\n],\n- \"time\": \"2018-07-26T11:24:31+00:00\"\n+ \"time\": \"2018-08-03T07:58:40+00:00\"\n},\n{\n\"name\": \"symfony/stopwatch\",\n- \"version\": \"v4.1.3\",\n+ \"version\": \"v4.1.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/stopwatch.git\",\n},\n{\n\"name\": \"symfony/twig-bridge\",\n- \"version\": \"v4.1.3\",\n+ \"version\": \"v4.1.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/twig-bridge.git\",\n- \"reference\": \"0fdf6b2e69c514e1b178ee823dd6bc9950db4a2f\"\n+ \"reference\": \"550cd9cd3a106a3426bdb2bd9d2914a4937656d1\"\n},\n\"dist\": {\n\"type\": \"zip\",\n- \"url\": \"https://api.github.com/repos/symfony/twig-bridge/zipball/0fdf6b2e69c514e1b178ee823dd6bc9950db4a2f\",\n- \"reference\": \"0fdf6b2e69c514e1b178ee823dd6bc9950db4a2f\",\n+ \"url\": \"https://api.github.com/repos/symfony/twig-bridge/zipball/550cd9cd3a106a3426bdb2bd9d2914a4937656d1\",\n+ \"reference\": \"550cd9cd3a106a3426bdb2bd9d2914a4937656d1\",\n\"shasum\": \"\"\n},\n\"require\": {\n],\n\"description\": \"Symfony Twig Bridge\",\n\"homepage\": \"https://symfony.com\",\n- \"time\": \"2018-07-26T11:24:31+00:00\"\n+ \"time\": \"2018-08-14T15:48:59+00:00\"\n},\n{\n\"name\": \"symfony/twig-bundle\",\n- \"version\": \"v4.1.3\",\n+ \"version\": \"v4.1.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/twig-bundle.git\",\n},\n{\n\"name\": \"symfony/var-dumper\",\n- \"version\": \"v4.1.3\",\n+ \"version\": \"v4.1.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/var-dumper.git\",\n- \"reference\": \"69e174f4c02ec43919380171c6f7550753299316\"\n+ \"reference\": \"a05426e27294bba7b0226ffc17dd01a3c6ef9777\"\n},\n\"dist\": {\n\"type\": \"zip\",\n- \"url\": \"https://api.github.com/repos/symfony/var-dumper/zipball/69e174f4c02ec43919380171c6f7550753299316\",\n- \"reference\": \"69e174f4c02ec43919380171c6f7550753299316\",\n+ \"url\": \"https://api.github.com/repos/symfony/var-dumper/zipball/a05426e27294bba7b0226ffc17dd01a3c6ef9777\",\n+ \"reference\": \"a05426e27294bba7b0226ffc17dd01a3c6ef9777\",\n\"shasum\": \"\"\n},\n\"require\": {\n\"debug\",\n\"dump\"\n],\n- \"time\": \"2018-07-26T11:24:31+00:00\"\n+ \"time\": \"2018-08-02T09:24:26+00:00\"\n},\n{\n\"name\": \"symfony/web-profiler-bundle\",\n- \"version\": \"v4.1.3\",\n+ \"version\": \"v4.1.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/web-profiler-bundle.git\",\n- \"reference\": \"b599234072688d2939ba29258589d92047d0a4c9\"\n+ \"reference\": \"085fe3d8b7841b156cc1dc5aa7df9bdc81316edb\"\n},\n\"dist\": {\n\"type\": \"zip\",\n- \"url\": \"https://api.github.com/repos/symfony/web-profiler-bundle/zipball/b599234072688d2939ba29258589d92047d0a4c9\",\n- \"reference\": \"b599234072688d2939ba29258589d92047d0a4c9\",\n+ \"url\": \"https://api.github.com/repos/symfony/web-profiler-bundle/zipball/085fe3d8b7841b156cc1dc5aa7df9bdc81316edb\",\n+ \"reference\": \"085fe3d8b7841b156cc1dc5aa7df9bdc81316edb\",\n\"shasum\": \"\"\n},\n\"require\": {\n],\n\"description\": \"Symfony WebProfilerBundle\",\n\"homepage\": \"https://symfony.com\",\n- \"time\": \"2018-07-26T11:24:31+00:00\"\n+ \"time\": \"2018-08-09T19:58:21+00:00\"\n},\n{\n\"name\": \"symfony/yaml\",\n- \"version\": \"v4.1.3\",\n+ \"version\": \"v4.1.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/yaml.git\",\n- \"reference\": \"46bc69aa91fc4ab78a96ce67873a6b0c148fd48c\"\n+ \"reference\": \"b832cc289608b6d305f62149df91529a2ab3c314\"\n},\n\"dist\": {\n\"type\": \"zip\",\n- \"url\": \"https://api.github.com/repos/symfony/yaml/zipball/46bc69aa91fc4ab78a96ce67873a6b0c148fd48c\",\n- \"reference\": \"46bc69aa91fc4ab78a96ce67873a6b0c148fd48c\",\n+ \"url\": \"https://api.github.com/repos/symfony/yaml/zipball/b832cc289608b6d305f62149df91529a2ab3c314\",\n+ \"reference\": \"b832cc289608b6d305f62149df91529a2ab3c314\",\n\"shasum\": \"\"\n},\n\"require\": {\n],\n\"description\": \"Symfony Yaml Component\",\n\"homepage\": \"https://symfony.com\",\n- \"time\": \"2018-07-26T11:24:31+00:00\"\n+ \"time\": \"2018-08-18T16:52:46+00:00\"\n},\n{\n\"name\": \"twig/twig\",\n\"packages-dev\": [\n{\n\"name\": \"symfony/dotenv\",\n- \"version\": \"v4.1.3\",\n+ \"version\": \"v4.1.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/dotenv.git\",\n},\n{\n\"name\": \"symfony/process\",\n- \"version\": \"v4.1.3\",\n+ \"version\": \"v4.1.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/process.git\",\n- \"reference\": \"f01fc7a4493572f7f506c49dcb50ad01fb3a2f56\"\n+ \"reference\": \"86cdb930a6a855b0ab35fb60c1504cb36184f843\"\n},\n\"dist\": {\n\"type\": \"zip\",\n- \"url\": \"https://api.github.com/repos/symfony/process/zipball/f01fc7a4493572f7f506c49dcb50ad01fb3a2f56\",\n- \"reference\": \"f01fc7a4493572f7f506c49dcb50ad01fb3a2f56\",\n+ \"url\": \"https://api.github.com/repos/symfony/process/zipball/86cdb930a6a855b0ab35fb60c1504cb36184f843\",\n+ \"reference\": \"86cdb930a6a855b0ab35fb60c1504cb36184f843\",\n\"shasum\": \"\"\n},\n\"require\": {\n],\n\"description\": \"Symfony Process Component\",\n\"homepage\": \"https://symfony.com\",\n- \"time\": \"2018-07-26T11:24:31+00:00\"\n+ \"time\": \"2018-08-03T11:13:38+00:00\"\n},\n{\n\"name\": \"symfony/web-server-bundle\",\n- \"version\": \"v4.1.3\",\n+ \"version\": \"v4.1.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/web-server-bundle.git\",\n" }, { "change_type": "MODIFY", "old_path": "config/packages/doctrine.yaml", "new_path": "config/packages/doctrine.yaml", "diff": "@@ -25,5 +25,5 @@ doctrine:\nis_bundle: false\ntype: annotation\ndir: '%kernel.project_dir%/src/Entity'\n- prefix: 'App\\Entity'\n- alias: App\n+ prefix: 'Bolt\\Entity'\n+ alias: Bolt\n" }, { "change_type": "MODIFY", "old_path": "config/routes.yaml", "new_path": "config/routes.yaml", "diff": "#index:\n# path: /\n-# controller: App\\Controller\\DefaultController::index\n+# controller: Bolt\\Controller\\DefaultController::index\n" }, { "change_type": "MODIFY", "old_path": "config/services.yaml", "new_path": "config/services.yaml", "diff": "@@ -13,13 +13,13 @@ services:\n# makes classes in src/ available to be used as services\n# this creates a service per class whose id is the fully-qualified class name\n- App\\:\n+ Bolt\\:\nresource: '../src/*'\nexclude: '../src/{Entity,Migrations,Tests,Kernel.php}'\n# controllers are imported separately to make sure services can be injected\n# as action arguments even if you don't extend any base controller class\n- App\\Controller\\:\n+ Bolt\\Controller\\:\nresource: '../src/Controller'\ntags: ['controller.service_arguments']\n" }, { "change_type": "MODIFY", "old_path": "public/index.php", "new_path": "public/index.php", "diff": "<?php\n-use App\\Kernel;\n+use Bolt\\Kernel;\nuse Symfony\\Component\\Debug\\Debug;\nuse Symfony\\Component\\Dotenv\\Dotenv;\nuse Symfony\\Component\\HttpFoundation\\Request;\n" }, { "change_type": "MODIFY", "old_path": "src/Configuration/Config.php", "new_path": "src/Configuration/Config.php", "diff": "* @author Bob den Otter <bobdenotter@gmail.com>\n*/\n-namespace App\\Configuration;\n+namespace Bolt\\Configuration;\n-use App\\Helpers\\Html;\n-use App\\Helpers\\Str;\n+use Bolt\\Helpers\\Html;\n+use Bolt\\Helpers\\Str;\nuse Bolt\\Collection\\Arr;\nuse Bolt\\Collection\\Bag;\nuse Symfony\\Component\\Config\\FileLocator;\n@@ -256,7 +256,7 @@ class Config\n],\n'htmlcleaner' => [\n'allowed_tags' => explode(',', 'div,span,p,br,hr,s,u,strong,em,i,b,li,ul,ol,mark,blockquote,pre,code,tt,h1,h2,h3,h4,h5,h6,dd,dl,dh,table,tbody,thead,tfoot,th,td,tr,a,img,address,abbr,iframe'),\n- 'allowed_attributes' => explode(',', 'id,class,style,name,value,href,src,alt,title,width,height,frameborder,allowfullscreen,scrolling'),\n+ 'allowed_attributes' => explode(',', 'id,class,style,name,value,href,Bolt,alt,title,width,height,frameborder,allowfullscreen,scrolling'),\n],\n'performance' => [\n'http_cache' => [\n" }, { "change_type": "MODIFY", "old_path": "src/Configuration/PathResolver.php", "new_path": "src/Configuration/PathResolver.php", "diff": "<?php\n-namespace App\\Configuration;\n+namespace Bolt\\Configuration;\nuse Bolt\\Exception\\PathResolutionException;\nuse Webmozart\\PathUtil\\Path;\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/Async/News.php", "new_path": "src/Controller/Async/News.php", "diff": "<?php\n-namespace App\\Controller\\Async;\n+namespace Bolt\\Controller\\Async;\n-use App\\Configuration\\Config;\n-use App\\Version;\n+use Bolt\\Configuration\\Config;\n+use Bolt\\Version;\nuse Bolt\\Common\\Exception\\ParseException;\nuse Bolt\\Common\\Json;\nuse GuzzleHttp\\Client;\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/DefaultController.php", "new_path": "src/Controller/DefaultController.php", "diff": "<?php\n-namespace App\\Controller;\n+namespace Bolt\\Controller;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\Routing\\Annotation\\Route;\n" }, { "change_type": "MODIFY", "old_path": "src/Helpers/Html.php", "new_path": "src/Helpers/Html.php", "diff": "<?php\n-namespace App\\Helpers;\n+namespace Bolt\\Helpers;\nclass Html\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Helpers/Str.php", "new_path": "src/Helpers/Str.php", "diff": "<?php\n-namespace App\\Helpers;\n+namespace Bolt\\Helpers;\nuse Cocur\\Slugify\\Slugify;\n" }, { "change_type": "MODIFY", "old_path": "src/Kernel.php", "new_path": "src/Kernel.php", "diff": "<?php\n-namespace App;\n+namespace Bolt;\nuse Symfony\\Bundle\\FrameworkBundle\\Kernel\\MicroKernelTrait;\nuse Symfony\\Component\\Config\\Loader\\LoaderInterface;\n" }, { "change_type": "MODIFY", "old_path": "src/Version.php", "new_path": "src/Version.php", "diff": "<?php\n-namespace App;\n+namespace Bolt;\n/**\n* Bolt's current version.\n" } ]
PHP
MIT License
bolt/core
Rename `App\` to `Bolt\`
95,168
11.09.2018 12:29:24
-7,200
565627aabf9aa968d0805012fbd5ef93759c928d
Install symfony/intl and symfony/apache-pack Bob and I are not sure if this packages really need to be required. They were install to create and .htacces file and fix an error for missing IntlTimeZone
[ { "change_type": "MODIFY", "old_path": "composer.json", "new_path": "composer.json", "diff": "\"guzzlehttp/guzzle\": \"^6.3\",\n\"sensio/framework-extra-bundle\": \"^5.1\",\n\"sensiolabs/security-checker\": \"^4.1\",\n+ \"symfony/apache-pack\": \"^1.0\",\n\"symfony/asset\": \"^4.1\",\n\"symfony/console\": \"^4.1\",\n\"symfony/debug-pack\": \"^1.0\",\n\"symfony/flex\": \"^1.1\",\n\"symfony/form\": \"^4.1\",\n\"symfony/framework-bundle\": \"^4.1\",\n+ \"symfony/intl\": \"^4.1\",\n\"symfony/lts\": \"^4@dev\",\n\"symfony/orm-pack\": \"^1.0\",\n\"symfony/polyfill-php72\": \"^1.8\",\n" }, { "change_type": "MODIFY", "old_path": "composer.lock", "new_path": "composer.lock", "diff": "\"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies\",\n\"This file is @generated automatically\"\n],\n- \"content-hash\": \"4305ed0f816d8b9368eab75aded6b067\",\n+ \"content-hash\": \"547395b27da5010e3d2ba38ade248f18\",\n\"packages\": [\n{\n\"name\": \"bolt/collection\",\n],\n\"time\": \"2018-07-13T07:04:35+00:00\"\n},\n+ {\n+ \"name\": \"symfony/apache-pack\",\n+ \"version\": \"v1.0.1\",\n+ \"source\": {\n+ \"type\": \"git\",\n+ \"url\": \"https://github.com/symfony/apache-pack.git\",\n+ \"reference\": \"3aa5818d73ad2551281fc58a75afd9ca82622e6c\"\n+ },\n+ \"dist\": {\n+ \"type\": \"zip\",\n+ \"url\": \"https://api.github.com/repos/symfony/apache-pack/zipball/3aa5818d73ad2551281fc58a75afd9ca82622e6c\",\n+ \"reference\": \"3aa5818d73ad2551281fc58a75afd9ca82622e6c\",\n+ \"shasum\": \"\"\n+ },\n+ \"type\": \"symfony-pack\",\n+ \"notification-url\": \"https://packagist.org/downloads/\",\n+ \"license\": [\n+ \"MIT\"\n+ ],\n+ \"description\": \"A pack for Apache support in Symfony\",\n+ \"time\": \"2017-12-12T01:46:35+00:00\"\n+ },\n{\n\"name\": \"symfony/asset\",\n\"version\": \"v4.1.4\",\n" }, { "change_type": "MODIFY", "old_path": "symfony.lock", "new_path": "symfony.lock", "diff": "\"swiftmailer/swiftmailer\": {\n\"version\": \"v6.0.2\"\n},\n+ \"symfony/apache-pack\": {\n+ \"version\": \"1.0\",\n+ \"recipe\": {\n+ \"repo\": \"github.com/symfony/recipes-contrib\",\n+ \"branch\": \"master\",\n+ \"version\": \"1.0\",\n+ \"ref\": \"c82bead70f9a4f656354a193df7bf0ca2114efa0\"\n+ }\n+ },\n\"symfony/asset\": {\n\"version\": \"v3.4.0-beta2\"\n},\n" } ]
PHP
MIT License
bolt/core
Install symfony/intl and symfony/apache-pack Bob and I are not sure if this packages really need to be required. They were install to create and .htacces file and fix an error for missing IntlTimeZone
95,168
11.09.2018 14:25:35
-7,200
8ed3605ad1b85539e1c7abd6cf3125912be3dce2
Update yarn.lock (Install axios package)
[ { "change_type": "MODIFY", "old_path": "yarn.lock", "new_path": "yarn.lock", "diff": "@@ -336,6 +336,13 @@ aws4@^1.2.1:\nversion \"1.6.0\"\nresolved \"https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e\"\n+axios@^0.18.0:\n+ version \"0.18.0\"\n+ resolved \"http://registry.npmjs.org/axios/-/axios-0.18.0.tgz#32d53e4851efdc0a11993b6cd000789d70c05102\"\n+ dependencies:\n+ follow-redirects \"^1.3.0\"\n+ is-buffer \"^1.1.5\"\n+\nbabel-code-frame@^6.11.0, babel-code-frame@^6.22.0:\nversion \"6.22.0\"\nresolved \"https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4\"\n@@ -1565,6 +1572,12 @@ debug@^2.1.2, debug@^2.3.3:\ndependencies:\nms \"2.0.0\"\n+debug@^3.1.0:\n+ version \"3.2.4\"\n+ resolved \"https://registry.yarnpkg.com/debug/-/debug-3.2.4.tgz#82123737c51afbe9609a2b5dfe9664e7487171f0\"\n+ dependencies:\n+ ms \"^2.1.1\"\n+\ndebug@~2.2.0:\nversion \"2.2.0\"\nresolved \"https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da\"\n@@ -2150,6 +2163,12 @@ flatten@^1.0.2:\nversion \"1.0.2\"\nresolved \"https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782\"\n+follow-redirects@^1.3.0:\n+ version \"1.5.7\"\n+ resolved \"https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.7.tgz#a39e4804dacb90202bca76a9e2ac10433ca6a69a\"\n+ dependencies:\n+ debug \"^3.1.0\"\n+\nfor-in@^1.0.1, for-in@^1.0.2:\nversion \"1.0.2\"\nresolved \"https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80\"\n@@ -3331,6 +3350,10 @@ ms@2.0.0:\nversion \"2.0.0\"\nresolved \"https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8\"\n+ms@^2.1.1:\n+ version \"2.1.1\"\n+ resolved \"https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a\"\n+\nmulticast-dns-service-types@^1.1.0:\nversion \"1.1.0\"\nresolved \"https://registry.yarnpkg.com/multicast-dns-service-types/-/multicast-dns-service-types-1.1.0.tgz#899f11d9686e5e05cb91b35d5f0e63b773cfc901\"\n" } ]
PHP
MIT License
bolt/core
Update yarn.lock (Install axios package)
95,168
11.09.2018 17:34:10
-7,200
e56ec0ced011a4e5a2095072386c84f1349aef0c
[WIP] Implement Workbox
[ { "change_type": "MODIFY", "old_path": "webpack.config.js", "new_path": "webpack.config.js", "diff": "var Encore = require('@symfony/webpack-encore');\n+const WorkboxPlugin = require('workbox-webpack-plugin');\n+\nEncore\n// the project directory where all compiled assets will be stored\n.setOutputPath('public/assets/')\n@@ -11,6 +13,18 @@ Encore\n.autoProvidejQuery()\n.enableVueLoader()\n+ // TODO: To keep or be removed if not needed\n+ // filenames include a hash that changes whenever the file contents change\n+ .enableVersioning()\n+\n+ // .addPlugin(\n+ // new WorkboxPlugin.GenerateSW({\n+ // // these options encourage the ServiceWorkers to get in there fast\n+ // // and not allow any straggling \"old\" SWs to hang around\n+ // clientsClaim: true,\n+ // skipWaiting: true,\n+ // importsDirectory: 'sw/'\n+ // }))\n;\n// export the final configuration\n" } ]
PHP
MIT License
bolt/core
[WIP] Implement Workbox
95,168
13.09.2018 17:24:38
-7,200
e69cadfec965f5ac4d8d40e8d3f1760a34efa4ff
Config for workbox
[ { "change_type": "MODIFY", "old_path": "assets/js/bolt.js", "new_path": "assets/js/bolt.js", "diff": "import Vue from 'vue'\nimport ElementUI from 'element-ui';\nimport 'element-ui/lib/theme-chalk/index.css';\n+import './registerServiceWorker'\n// Bolt Components\nimport Hello from './Hello'\n" }, { "change_type": "ADD", "old_path": null, "new_path": "assets/js/registerServiceWorker.js", "diff": "+/* eslint-disable no-console */\n+\n+import { register } from 'register-service-worker'\n+\n+// if (process.env.NODE_ENV === 'production') {\n+ register('/assets/service-worker.js', {\n+ ready () {\n+ console.log(\n+ 'App is being served from cache by a service worker.\\n' +\n+ 'For more details, visit https://goo.gl/AFskqB'\n+ )\n+ },\n+ cached () {\n+ console.log('Content has been cached for offline use.')\n+ },\n+ updated () {\n+ console.log('New content is available; please refresh.')\n+ },\n+ offline () {\n+ console.log('No internet connection found. App is running in offline mode.')\n+ },\n+ error (error) {\n+ console.error('Error during service worker registration:', error)\n+ }\n+ })\n+// }\n" }, { "change_type": "ADD", "old_path": null, "new_path": "public/assets/service-worker.js", "diff": "+/**\n+ * Welcome to your Workbox-powered service worker!\n+ *\n+ * You'll need to register this file in your web app and you should\n+ * disable HTTP caching for this file too.\n+ * See https://goo.gl/nhQhGp\n+ *\n+ * The rest of the code is auto-generated. Please don't update this file\n+ * directly; instead, make changes to your Workbox build configuration\n+ * and re-run your build process.\n+ * See https://goo.gl/2aRDsh\n+ */\n+\n+importScripts(\"https://storage.googleapis.com/workbox-cdn/releases/3.5.0/workbox-sw.js\");\n+\n+importScripts(\n+ \"/assets/sw/precache-manifest.dc633e0b7295bd21eeb0d5a727ef7314.js\"\n+);\n+\n+workbox.clientsClaim();\n+\n+/**\n+ * The workboxSW.precacheAndRoute() method efficiently caches and responds to\n+ * requests for URLs in the manifest.\n+ * See https://goo.gl/S9QRab\n+ */\n+self.__precacheManifest = [].concat(self.__precacheManifest || []);\n+workbox.precaching.suppressWarnings();\n+workbox.precaching.precacheAndRoute(self.__precacheManifest, {});\n" }, { "change_type": "ADD", "old_path": null, "new_path": "public/assets/sw/precache-manifest.dc633e0b7295bd21eeb0d5a727ef7314.js", "diff": "+self.__precacheManifest = [\n+ {\n+ \"revision\": \"6f0a76321d30f3c8120915e57f7bd77e\",\n+ \"url\": \"/assets/fonts/element-icons.6f0a7632.ttf\"\n+ },\n+ {\n+ \"revision\": \"2fad952a20fbbcfd1bf2ebb210dccf7a\",\n+ \"url\": \"/assets/fonts/element-icons.2fad952a.woff\"\n+ },\n+ {\n+ \"revision\": \"c6a48af7372efaa04aa9\",\n+ \"url\": \"/assets/bolt.js\"\n+ },\n+ {\n+ \"revision\": \"c6a48af7372efaa04aa9\",\n+ \"url\": \"/assets/bolt.css\"\n+ }\n+];\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "webpack.config.js", "new_path": "webpack.config.js", "diff": "@@ -15,16 +15,17 @@ Encore\n// TODO: To keep or be removed if not needed\n// filenames include a hash that changes whenever the file contents change\n- .enableVersioning()\n+ // .enableVersioning()\n- // .addPlugin(\n- // new WorkboxPlugin.GenerateSW({\n- // // these options encourage the ServiceWorkers to get in there fast\n- // // and not allow any straggling \"old\" SWs to hang around\n- // clientsClaim: true,\n- // skipWaiting: true,\n- // importsDirectory: 'sw/'\n- // }))\n+ // Workbox should always be the last plugin to add @see: https://developers.google.com/web/tools/workbox/guides/codelabs/webpack#optional-config\n+ .addPlugin(\n+ new WorkboxPlugin.GenerateSW({\n+ // these options encourage the ServiceWorkers to get in there fast\n+ // and not allow any straggling \"old\" SWs to hang around\n+ clientsClaim: true,\n+ skipWaiting: false,\n+ importsDirectory: 'sw/',\n+ }))\n;\n// export the final configuration\n" } ]
PHP
MIT License
bolt/core
Config for workbox
95,168
13.09.2018 17:25:37
-7,200
9513fd0d2a9a12e035dc0ef4c46333460c3b5095
Install register-service-worker package
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"devDependencies\": {\n\"@symfony/webpack-encore\": \"^0.20.1\",\n\"jquery\": \"^3.3.1\",\n+ \"register-service-worker\": \"^1.5.2\",\n\"vue-loader\": \"^14\",\n\"vue-template-compiler\": \"^2.5.17\",\n\"workbox-webpack-plugin\": \"^3.5.0\"\n" } ]
PHP
MIT License
bolt/core
Install register-service-worker package
95,144
16.09.2018 16:56:36
-7,200
3c42aa96789d7e638bb15b47b5cb179fd09aafe9
Working on contenttypes
[ { "change_type": "MODIFY", "old_path": "config/services.yaml", "new_path": "config/services.yaml", "diff": "@@ -35,3 +35,9 @@ services:\n# 'arguments' key and define the arguments just below the service class\nBolt\\EventSubscriber\\CommentNotificationSubscriber:\n$sender: '%app.notifications.email_sender%'\n+\n+ doctrine.content_listener:\n+ class: Bolt\\EventListener\\ContentListener\n+ arguments: []\n+ tags:\n+ - { name: doctrine.event_listener, event: postLoad }\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "src/Configuration/Config.php", "new_path": "src/Configuration/Config.php", "diff": "<?php\n-/**\n- * @author Bob den Otter <bobdenotter@gmail.com>\n- */\nnamespace Bolt\\Configuration;\n@@ -9,6 +6,7 @@ use Bolt\\Collection\\Arr;\nuse Bolt\\Collection\\Bag;\nuse Bolt\\Helpers\\Html;\nuse Bolt\\Helpers\\Str;\n+use Cocur\\Slugify\\Slugify;\nuse Symfony\\Component\\Config\\FileLocator;\nuse Symfony\\Component\\Yaml\\Yaml;\nuse Webmozart\\PathUtil\\Path;\n@@ -37,7 +35,7 @@ class Config\n// $data = $this->loadCache();\nif ($data === null) {\n- $data = $this->getConfig();\n+ $data = $this->parseConfig();\n// If we have to reload the config, we will also want to make sure\n// the DB integrity is checked.\n@@ -57,25 +55,37 @@ class Config\n*\n* @return array\n*/\n- public function getConfig()\n+ public function parseConfig()\n{\n$config = Bag::from([\n'general' => $this->parseGeneral(),\n+ ]);\n+\n+ $this->data = $config;\n+\n+ $config['contenttypes'] = $this->parseContentTypes();\n// 'taxonomy' => $this->parseTaxonomy(),\n- // 'contenttypes' => $this->parseContentTypes($config['general']),\n+\n// 'menu' => $this->parseConfigYaml('menu.yml'),\n//'routing' => $this->parseConfigYaml('routing.yml'),\n//'permissions' => $this->parseConfigYaml('permissions.yml'),\n//'extensions' => $this->parseConfigYaml('extensions.yml'),\n- ]);\n+\n+// dump($config);\n+// die();\nreturn $config;\n}\n+ public function get(string $name)\n+ {\n+ return $this->data[$name];\n+ }\n+\n/**\n* Read and parse the config.yaml and config_local.yaml configuration files.\n*\n- * @return array\n+ * @return Bag\n*/\nprotected function parseGeneral()\n{\n@@ -85,12 +95,6 @@ class Config\n$mergedarray = Arr::replaceRecursive($defaultconfig, Arr::replaceRecursive($tempconfig, $tempconfiglocal));\n$general = Bag::fromRecursive($mergedarray);\n- // Make sure old settings for 'accept_file_types' are not still picked up. Before 1.5.4 we used to store them\n- // as a regex-like string, and we switched to an array. If we find the old style, fall back to the defaults.\n- if (isset($general['accept_file_types']) && !is_array($general['accept_file_types'])) {\n- unset($general['accept_file_types']);\n- }\n-\n// Make sure Bolt's mount point is OK:\n$general['branding']['path'] = '/' . Str::makeSafe($general['branding']['path']);\n@@ -104,10 +108,26 @@ class Config\nreturn $general;\n}\n- public function get()\n+ /**\n+ * Read and parse the contenttypes.yml configuration file.\n+ *\n+ *\n+ * @return array\n+ */\n+ protected function parseContentTypes()\n{\n-// echo \"joe\";\n-// die();\n+ $contentTypes = new Bag();\n+ $tempContentTypes = $this->parseConfigYaml('contenttypes.yml');\n+ foreach ($tempContentTypes as $key => $contentType) {\n+ try {\n+ $contentType = $this->parseContentType($key, $contentType);\n+ $contentTypes[$key] = $contentType;\n+ } catch (InvalidArgumentException $e) {\n+ $this->exceptions[] = $e->getMessage();\n+ }\n+ }\n+\n+ return Bag::fromRecursive($contentTypes);\n}\n/**\n@@ -263,6 +283,104 @@ class Config\n];\n}\n+ /**\n+ * Parse a single Contenttype configuration array.\n+ *\n+ * @param string $key\n+ * @param array $contentType\n+ *\n+ * @throws InvalidArgumentException\n+ *\n+ * @return array\n+ */\n+ protected function parseContentType($key, $contentType)\n+ {\n+ // If the slug isn't set, and the 'key' isn't numeric, use that as the slug.\n+ if (!isset($contentType['slug']) && !is_numeric($key)) {\n+ $contentType['slug'] = Slugify::create()->slugify($key);\n+ }\n+\n+ // If neither 'name' nor 'slug' is set, we need to warn the user. Same goes for when\n+ // neither 'singular_name' nor 'singular_slug' is set.\n+ if (!isset($contentType['name']) && !isset($contentType['slug'])) {\n+ $error = sprintf(\"In contenttype <code>%s</code>, neither 'name' nor 'slug' is set. Please edit <code>contenttypes.yml</code>, and correct this.\", $key);\n+ throw new InvalidArgumentException($error);\n+ }\n+ if (!isset($contentType['singular_name']) && !isset($contentType['singular_slug'])) {\n+ $error = sprintf(\"In contenttype <code>%s</code>, neither 'singular_name' nor 'singular_slug' is set. Please edit <code>contenttypes.yml</code>, and correct this.\", $key);\n+ throw new InvalidArgumentException($error);\n+ }\n+\n+ // Contenttypes without fields make no sense.\n+ if (!isset($contentType['fields'])) {\n+ $error = sprintf(\"In contenttype <code>%s</code>, no 'fields' are set. Please edit <code>contenttypes.yml</code>, and correct this.\", $key);\n+ throw new InvalidArgumentException($error);\n+ }\n+\n+ if (!isset($contentType['slug'])) {\n+ $contentType['slug'] = Slugify::create()->slugify($contentType['name']);\n+ }\n+ if (!isset($contentType['name'])) {\n+ $contentType['name'] = ucwords(preg_replace('/[^a-z0-9]/i', ' ', $contentType['slug']));\n+ }\n+ if (!isset($contentType['singular_slug'])) {\n+ $contentType['singular_slug'] = Slugify::create()->slugify($contentType['singular_name']);\n+ }\n+ if (!isset($contentType['singular_name'])) {\n+ $contentType['singular_name'] = ucwords(preg_replace('/[^a-z0-9]/i', ' ', $contentType['singular_slug']));\n+ }\n+ if (!isset($contentType['show_on_dashboard'])) {\n+ $contentType['show_on_dashboard'] = true;\n+ }\n+ if (!isset($contentType['show_in_menu'])) {\n+ $contentType['show_in_menu'] = true;\n+ }\n+ if (!isset($contentType['sort'])) {\n+ $contentType['sort'] = false;\n+ }\n+ if (!isset($contentType['default_status'])) {\n+ $contentType['default_status'] = 'published';\n+ }\n+ if (!isset($contentType['viewless'])) {\n+ $contentType['viewless'] = false;\n+ }\n+\n+ // Allow explicit setting of a Contenttype's table name suffix. We default\n+ // to slug if not present as it has been this way since Bolt v1.2.1\n+ if (!isset($contentType['tablename'])) {\n+ $contentType['tablename'] = Slugify::create()->slugify($contentType['slug'], '_');\n+ } else {\n+ $contentType['tablename'] = Slugify::create()->slugify($contentType['tablename'], '_');\n+ }\n+ if (!isset($contentType['allow_numeric_slugs'])) {\n+ $contentType['allow_numeric_slugs'] = false;\n+ }\n+ if (!isset($contentType['singleton'])) {\n+ $contentType['singleton'] = false;\n+ }\n+\n+ list($fields, $groups) = $this->parseFieldsAndGroups($contentType['fields']);\n+ $contentType['fields'] = $fields;\n+ $contentType['groups'] = $groups;\n+\n+ // Make sure taxonomy is an array.\n+ if (isset($contentType['taxonomy'])) {\n+ $contentType['taxonomy'] = (array) $contentType['taxonomy'];\n+ }\n+\n+ // when adding relations, make sure they're added by their slug. Not their 'name' or 'singular name'.\n+ if (!empty($contentType['relations']) && is_array($contentType['relations'])) {\n+ foreach (array_keys($contentType['relations']) as $relkey) {\n+ if ($relkey !== Slugify::create()->slugify($relkey)) {\n+ $contentType['relations'][Slugify::create()->slugify($relkey)] = $contentType['relations'][$relkey];\n+ unset($contentType['relations'][$relkey]);\n+ }\n+ }\n+ }\n+\n+ return $contentType;\n+ }\n+\n/**\n* Parse and fine-tune the database configuration.\n*\n@@ -321,6 +439,119 @@ class Config\nreturn $options;\n}\n+ /**\n+ * Parse a Contenttype's field and determine the grouping.\n+ *\n+ *\n+ * @return array\n+ */\n+ protected function parseFieldsAndGroups(array $fields)\n+ {\n+ $acceptableFileTypes = $this->get('general')['accept_file_types'];\n+\n+ $currentGroup = 'ungrouped';\n+ $groups = [];\n+ $hasGroups = false;\n+\n+ foreach ($fields as $key => $field) {\n+ unset($fields[$key]);\n+ $key = str_replace('-', '_', mb_strtolower(Str::makeSafe($key, true)));\n+ if (!isset($field['type']) || empty($field['type'])) {\n+ $error = sprintf('Field \"%s\" has no \"type\" set.', $key);\n+\n+ throw new InvalidArgumentException($error);\n+ }\n+\n+ // If field is a \"file\" type, make sure the 'extensions' are set, and it's an array.\n+ if ($field['type'] === 'file' || $field['type'] === 'filelist') {\n+ if (empty($field['extensions'])) {\n+ $field['extensions'] = $acceptableFileTypes;\n+ }\n+\n+ $field['extensions'] = (array) $field['extensions'];\n+ }\n+\n+ // If field is an \"image\" type, make sure the 'extensions' are set, and it's an array.\n+ if ($field['type'] === 'image' || $field['type'] === 'imagelist') {\n+ if (empty($field['extensions'])) {\n+ $field['extensions'] = Bag::from(['gif', 'jpg', 'jpeg', 'png', 'svg'])\n+ ->intersect($acceptableFileTypes);\n+ }\n+\n+ $field['extensions'] = (array) $field['extensions'];\n+ }\n+\n+ // Make indexed arrays into associative for select fields\n+ // e.g.: [ 'yes', 'no' ] => { 'yes': 'yes', 'no': 'no' }\n+ if ($field['type'] === 'select' && isset($field['values']) && Arr::isIndexed($field['values'])) {\n+ $field['values'] = array_combine($field['values'], $field['values']);\n+ }\n+\n+ if (!empty($field['group'])) {\n+ $hasGroups = true;\n+ }\n+\n+ // Make sure we have these keys and every field has a group set.\n+ $field = array_replace(\n+ [\n+ 'class' => '',\n+ 'default' => '',\n+ 'group' => $currentGroup,\n+ 'label' => '',\n+ 'variant' => '',\n+ ],\n+ $field\n+ );\n+\n+ // Collect group data for rendering.\n+ // Make sure that once you started with group all following have that group, too.\n+ $currentGroup = $field['group'];\n+ $groups[$currentGroup] = 1;\n+\n+ $fields[$key] = $field;\n+\n+ // Repeating fields checks\n+ if ($field['type'] === 'repeater') {\n+ $fields[$key] = $this->parseFieldRepeaters($fields, $key);\n+ if ($fields[$key] === null) {\n+ unset($fields[$key]);\n+ }\n+ }\n+ }\n+\n+ // Make sure the 'uses' of the slug is an array.\n+ if (isset($fields['slug']) && isset($fields['slug']['uses'])) {\n+ $fields['slug']['uses'] = (array) $fields['slug']['uses'];\n+ }\n+\n+ return [$fields, $hasGroups ? array_keys($groups) : []];\n+ }\n+\n+ /**\n+ * Basic validation of repeater fields.\n+ *\n+ * @param string $key\n+ *\n+ * @return array\n+ */\n+ private function parseFieldRepeaters(array $fields, $key)\n+ {\n+ $blacklist = ['repeater', 'slug', 'templatefield'];\n+ $repeater = $fields[$key];\n+\n+ if (!isset($repeater['fields']) || !is_array($repeater['fields'])) {\n+ return;\n+ }\n+\n+ foreach ($repeater['fields'] as $repeaterKey => $repeaterField) {\n+ if (!isset($repeaterField['type']) || in_array($repeaterField['type'], $blacklist, true)) {\n+ unset($repeater['fields'][$repeaterKey]);\n+ }\n+ }\n+\n+ return $repeater;\n+ }\n+\n/**\n* Fine-tune Sqlite configuration parameters.\n*\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Content/ContentType.php", "diff": "+<?php\n+\n+namespace Bolt\\Content;\n+\n+use Bolt\\Collection\\Bag;\n+\n+class ContentType extends Bag\n+{\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Content/ContentTypeFactory.php", "diff": "+<?php\n+\n+namespace Bolt\\Content;\n+\n+class ContentTypeFactory\n+{\n+ public function __construct()\n+ {\n+ }\n+\n+ public static function get($name, $config)\n+ {\n+ $ct = ContentType::from($config[$name]);\n+\n+ return $ct;\n+ }\n+}\n" }, { "change_type": "DELETE", "old_path": "src/Content/Contenttype.php", "new_path": null, "diff": "-<?php\n-/**\n- * @author Bob den Otter <bobdenotter@gmail.com>\n- */\n-\n-namespace Bolt\\Content;\n-\n-class Contenttype\n-{\n-}\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/Async/News.php", "new_path": "src/Controller/Async/News.php", "diff": "@@ -14,8 +14,6 @@ use Symfony\\Component\\Routing\\Annotation\\Route;\n/**\n* Fetching the news.\n- *\n- * @author Bob den Otter <bobdenotter@gmail.com>\n*/\nclass News\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/BlogController.php", "new_path": "src/Controller/BlogController.php", "diff": "@@ -62,6 +62,7 @@ class BlogController extends AbstractController\nif ($request->query->has('tag')) {\n$tag = $tags->findOneBy(['name' => $request->query->get('tag')]);\n}\n+ /** @var Content $latestContent */\n$latestContent = $content->findLatest($page, $tag);\nreturn $this->render('blog/listing.html.twig', ['records' => $latestContent]);\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/Content.php", "new_path": "src/Entity/Content.php", "diff": "namespace Bolt\\Entity;\nuse Bolt\\Configuration\\Config;\n+use Bolt\\Content\\ContentType;\n+use Bolt\\Content\\ContentTypeFactory;\nuse Doctrine\\Common\\Collections\\ArrayCollection;\nuse Doctrine\\Common\\Collections\\Collection;\nuse Doctrine\\ORM\\Mapping as ORM;\n@@ -10,6 +12,7 @@ use Doctrine\\ORM\\Mapping as ORM;\n/**\n* @ORM\\Entity(repositoryClass=\"Bolt\\Repository\\ContentRepository\")\n* @ORM\\Table(name=\"bolt_content\")\n+ * @ORM\\HasLifecycleCallbacks\n*/\nclass Content\n{\n@@ -23,9 +26,9 @@ class Content\nprivate $id;\n/**\n- * @ORM\\Column(type=\"string\", length=191)\n+ * @ORM\\Column(type=\"string\", length=191, name=\"contenttype\")\n*/\n- private $contenttype;\n+ private $contentType;\n/**\n* @var User\n@@ -78,23 +81,22 @@ class Content\nprivate $config;\n/**\n- * @var\n+ * @var ContentType\n*/\n- private $contentType;\n+ private $contentTypeDefinition;\npublic function __toString(): string\n{\nreturn (string) 'Content # ' . $this->getId();\n}\n- public function __construct(Config $config)\n+ public function __construct()\n{\n$this->createdAt = new \\DateTime();\n$this->modifiedAt = new \\DateTime();\n$this->publishedAt = new \\DateTime();\n$this->depublishedAt = new \\DateTime();\n$this->fields = new ArrayCollection();\n- $this->config = $config;\n}\npublic function getId(): ?int\n@@ -102,14 +104,31 @@ class Content\nreturn $this->id;\n}\n+ public function setConfig(Config $config)\n+ {\n+ $this->config = $config->get('contenttypes');\n+\n+ $this->contentTypeDefinition = ContentTypeFactory::get($this->contentType, $this->config);\n+ }\n+\n+ public function getConfig(): Config\n+ {\n+ return $this->config;\n+ }\n+\n+ public function getDefinition()\n+ {\n+ return $this->contentType;\n+ }\n+\npublic function getContenttype(): ?string\n{\n- return $this->contenttype;\n+ return $this->contentType;\n}\npublic function setContenttype(string $contenttype): self\n{\n- $this->contenttype = $contenttype;\n+ $this->contentType = $contenttype . 'foo';\nreturn $this;\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/EventListener/ContentListener.php", "diff": "+<?php\n+\n+namespace Bolt\\EventListener;\n+\n+use Bolt\\Configuration\\Config;\n+use Doctrine\\ORM\\Event\\LifecycleEventArgs;\n+\n+class ContentListener\n+{\n+ private $config;\n+\n+ public function __construct(Config $config)\n+ {\n+ $this->config = $config;\n+ }\n+\n+ public function postLoad(LifecycleEventArgs $args)\n+ {\n+ $entity = $args->getEntity();\n+\n+ if (method_exists($entity, 'setConfig')) {\n+ $entity->setConfig($this->config);\n+ }\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "templates/blog/listing.html.twig", "new_path": "templates/blog/listing.html.twig", "diff": "{% block body_id 'blog_index' %}\n{% block main %}\n+\n{% for record in records %}\n<hr>\n- <b>Record:</b>\n- {{ dump(record.config) }}\n+ <b>Record:</b><br>\n+ {#{{ dump(record.definition) }}#}\n+ {#{{ dump(record.contenttype) }}#}\n{% for field in record.fields %}\n<b>Field name:</b>\n- {{ field.name }} / {{ field.type }}\n- {{ dump(field.value) }}\n+ {{ field.sortorder }}. {{ field.name }} / {{ field.type }}\n+ <p>{{ field }}</p>\n{% endfor %}\n<hr>\n{% endfor %}\n#}\n+ {#\n{% if records.haveToPaginate %}\n<div class=\"navigation text-center\">\n{{ pagerfanta(records, 'twitter_bootstrap3_translated', {routeName: 'content_listing', routeParams: app.request.query.all}) }}\n</div>\n{% endif %}\n-\n+#}\n{% endblock %}\n{% block sidebar %}\n" } ]
PHP
MIT License
bolt/core
Working on contenttypes
95,168
17.09.2018 11:58:11
-7,200
b5116bdd814ac605988e5671b3d2ea5ccfa3aa49
Install vue-router
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"jquery\": \"^3.3.1\",\n\"register-service-worker\": \"^1.5.2\",\n\"vue-loader\": \"^14\",\n+ \"vue-router\": \"^3.0.1\",\n\"vue-template-compiler\": \"^2.5.17\",\n\"workbox-webpack-plugin\": \"^3.5.0\"\n},\n" }, { "change_type": "MODIFY", "old_path": "yarn.lock", "new_path": "yarn.lock", "diff": "@@ -5394,6 +5394,10 @@ vue-loader@^14:\nvue-style-loader \"^4.0.1\"\nvue-template-es2015-compiler \"^1.6.0\"\n+vue-router@^3.0.1:\n+ version \"3.0.1\"\n+ resolved \"https://registry.yarnpkg.com/vue-router/-/vue-router-3.0.1.tgz#d9b05ad9c7420ba0f626d6500d693e60092cc1e9\"\n+\nvue-style-loader@^4.0.1:\nversion \"4.1.2\"\nresolved \"https://registry.yarnpkg.com/vue-style-loader/-/vue-style-loader-4.1.2.tgz#dedf349806f25ceb4e64f3ad7c0a44fba735fcf8\"\n" } ]
PHP
MIT License
bolt/core
Install vue-router
95,168
17.09.2018 14:16:56
-7,200
84017bc3138c288ccc7b96d0f689e88661921e2a
Install API Platform
[ { "change_type": "MODIFY", "old_path": ".env.dist", "new_path": ".env.dist", "diff": "@@ -21,3 +21,7 @@ DATABASE_URL=sqlite:///%kernel.project_dir%/var/data/blog.sqlite\n# Delivery is disabled by default via \"null://localhost\"\nMAILER_URL=null://localhost\n###< symfony/swiftmailer-bundle ###\n+\n+###> nelmio/cors-bundle ###\n+CORS_ALLOW_ORIGIN=^https?://localhost(:[0-9]+)?$\n+###< nelmio/cors-bundle ###\n" }, { "change_type": "MODIFY", "old_path": "composer.json", "new_path": "composer.json", "diff": "\"require\": {\n\"php\": \"^7.1.3\",\n\"ext-pdo_sqlite\": \"*\",\n+ \"api-platform/api-pack\": \"^1.1\",\n\"bolt/collection\": \"^1.1\",\n\"bolt/common\": \"^1.1\",\n\"cocur/slugify\": \"^3.1\",\n" }, { "change_type": "MODIFY", "old_path": "config/bundles.php", "new_path": "config/bundles.php", "diff": "@@ -18,4 +18,6 @@ return [\nDoctrine\\Bundle\\FixturesBundle\\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],\nSymfony\\Bundle\\MakerBundle\\MakerBundle::class => ['dev' => true],\nEasyCorp\\Bundle\\EasyAdminBundle\\EasyAdminBundle::class => ['all' => true],\n+ Nelmio\\CorsBundle\\NelmioCorsBundle::class => ['all' => true],\n+ ApiPlatform\\Core\\Bridge\\Symfony\\Bundle\\ApiPlatformBundle::class => ['all' => true],\n];\n" }, { "change_type": "ADD", "old_path": null, "new_path": "config/packages/api_platform.yaml", "diff": "+api_platform:\n+ mapping:\n+ paths: ['%kernel.project_dir%/src/Entity']\n" }, { "change_type": "ADD", "old_path": null, "new_path": "config/packages/nelmio_cors.yaml", "diff": "+nelmio_cors:\n+ defaults:\n+ origin_regex: true\n+ allow_origin: ['%env(CORS_ALLOW_ORIGIN)%']\n+ allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE']\n+ allow_headers: ['Content-Type', 'Authorization']\n+ max_age: 3600\n+ paths:\n+ '^/': ~\n" }, { "change_type": "MODIFY", "old_path": "phpunit.xml.dist", "new_path": "phpunit.xml.dist", "diff": "<!-- ###+ symfony/swiftmailer-bundle ### -->\n<env name=\"MAILER_URL\" value=\"null://localhost\"/>\n<!-- ###- symfony/swiftmailer-bundle ### -->\n+\n+ <!-- ###+ nelmio/cors-bundle ### -->\n+ <env name=\"CORS_ALLOW_ORIGIN\" value=\"^https?://localhost(:[0-9]+)?$\"/>\n+ <!-- ###- nelmio/cors-bundle ### -->\n</php>\n<testsuites>\n" }, { "change_type": "MODIFY", "old_path": "symfony.lock", "new_path": "symfony.lock", "diff": "{\n+ \"api-platform/api-pack\": {\n+ \"version\": \"1.1.0\"\n+ },\n+ \"api-platform/core\": {\n+ \"version\": \"2.1\",\n+ \"recipe\": {\n+ \"repo\": \"github.com/symfony/recipes\",\n+ \"branch\": \"master\",\n+ \"version\": \"2.1\",\n+ \"ref\": \"18727d8f229306860b46955f438e1897421da689\"\n+ }\n+ },\n\"bolt/collection\": {\n\"version\": \"v1.1.2\"\n},\n\"monolog/monolog\": {\n\"version\": \"1.23.0\"\n},\n+ \"nelmio/cors-bundle\": {\n+ \"version\": \"1.5\",\n+ \"recipe\": {\n+ \"repo\": \"github.com/symfony/recipes\",\n+ \"branch\": \"master\",\n+ \"version\": \"1.5\",\n+ \"ref\": \"1fee84e00c71edee81aa54b470260779a890c9c6\"\n+ }\n+ },\n\"nikic/php-parser\": {\n\"version\": \"v4.0.3\"\n},\n\"php-cs-fixer/diff\": {\n\"version\": \"v1.2.0\"\n},\n+ \"phpdocumentor/reflection-common\": {\n+ \"version\": \"1.0.1\"\n+ },\n+ \"phpdocumentor/reflection-docblock\": {\n+ \"version\": \"4.3.0\"\n+ },\n+ \"phpdocumentor/type-resolver\": {\n+ \"version\": \"0.4.0\"\n+ },\n\"psr/cache\": {\n\"version\": \"1.0.1\"\n},\n\"symfony/property-access\": {\n\"version\": \"v3.4.0-beta2\"\n},\n+ \"symfony/property-info\": {\n+ \"version\": \"v4.1.4\"\n+ },\n\"symfony/routing\": {\n\"version\": \"3.3\",\n\"recipe\": {\n\"ref\": \"85834af1496735f28d831489d12ab1921a875e0d\"\n}\n},\n+ \"symfony/serializer\": {\n+ \"version\": \"v4.1.4\"\n+ },\n\"symfony/stopwatch\": {\n\"version\": \"v3.4.0-beta2\"\n},\n\"white-october/pagerfanta-bundle\": {\n\"version\": \"v1.0.8\"\n},\n+ \"willdurand/negotiation\": {\n+ \"version\": \"v2.3.1\"\n+ },\n\"zendframework/zend-code\": {\n\"version\": \"3.3.0\"\n},\n" } ]
PHP
MIT License
bolt/core
Install API Platform
95,168
17.09.2018 14:30:04
-7,200
66660af3cdda404dee33411f791317ea1fb65ada
Fix request call for Dashboard News
[ { "change_type": "MODIFY", "old_path": "assets/js/service/api/DashboardNews.js", "new_path": "assets/js/service/api/DashboardNews.js", "diff": "@@ -8,7 +8,7 @@ export default {\n},\nfetchNews() {\n- return axios.get('/en/async/news')\n+ return axios.get('/async/news')\n.then(response => {\n// save to localstorage _and_ return data\nlocalStorage.setItem('dashboardnews', JSON.stringify(response.data));\n" } ]
PHP
MIT License
bolt/core
Fix request call for Dashboard News
95,168
17.09.2018 14:48:08
-7,200
1c8bd4ab6a5673711a712ee49664cad6bd4398fc
Install Vuex
[ { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"vue-loader\": \"^14\",\n\"vue-router\": \"^3.0.1\",\n\"vue-template-compiler\": \"^2.5.17\",\n+ \"vuex\": \"^3.0.1\",\n\"workbox-webpack-plugin\": \"^3.5.0\"\n},\n\"dependencies\": {\n" }, { "change_type": "MODIFY", "old_path": "yarn.lock", "new_path": "yarn.lock", "diff": "@@ -5420,6 +5420,10 @@ vue@^2.5.17:\nversion \"2.5.17\"\nresolved \"https://registry.yarnpkg.com/vue/-/vue-2.5.17.tgz#0f8789ad718be68ca1872629832ed533589c6ada\"\n+vuex@^3.0.1:\n+ version \"3.0.1\"\n+ resolved \"https://registry.yarnpkg.com/vuex/-/vuex-3.0.1.tgz#e761352ebe0af537d4bb755a9b9dc4be3df7efd2\"\n+\nwatchpack@^1.4.0:\nversion \"1.6.0\"\nresolved \"https://registry.yarnpkg.com/watchpack/-/watchpack-1.6.0.tgz#4bc12c2ebe8aa277a71f1d3f14d685c7b446cd00\"\n" } ]
PHP
MIT License
bolt/core
Install Vuex
95,144
17.09.2018 17:15:36
-7,200
7f54ca325432e0403cf29ef42a41012e9c144f8d
Simple values, simple arrays
[ { "change_type": "MODIFY", "old_path": "src/DataFixtures/ContentFixtures.php", "new_path": "src/DataFixtures/ContentFixtures.php", "diff": "@@ -113,16 +113,19 @@ class ContentFixtures extends Fixture\ncase 'html':\ncase 'textarea':\ncase 'markdown':\n- $data = ['value' => $this->faker->paragraphs(3, true)];\n+ $data = [$this->faker->paragraphs(3, true)];\nbreak;\ncase 'image':\n$data = ['filename' => 'kitten.jpg', 'alt' => 'A cute kitten'];\nbreak;\ncase 'slug':\n- $data = ['value' => Slugify::create()->slugify($this->faker->sentence(3, true))];\n+ $data = [Slugify::create()->slugify($this->faker->sentence(3, true))];\n+ break;\n+ case 'text':\n+ $data = [$this->faker->sentence(6, true)];\nbreak;\ndefault:\n- $data = ['value' => $this->faker->sentence(6, true)];\n+ $data = [$this->faker->sentence(6, true)];\n}\nreturn $data;\n" } ]
PHP
MIT License
bolt/core
Simple values, simple arrays
95,144
17.09.2018 21:14:41
-7,200
7cb1af59e19f28f24ebed397593760799cdddfcc
Creating own frontendcontroller
[ { "change_type": "MODIFY", "old_path": "src/Controller/BlogController.php", "new_path": "src/Controller/BlogController.php", "diff": "@@ -54,18 +54,7 @@ final class BlogController extends AbstractController\nreturn $this->render('blog/index.' . $_format . '.twig', ['posts' => $latestPosts]);\n}\n- /**\n- * @Route(\"/content\", methods={\"GET\"}, name=\"content_listing\")\n- */\n- public function contentListing(ContentRepository $content, Request $request): Response\n- {\n- $page = (int) $request->query->get('page', 1);\n- /** @var Content $records */\n- $records = $content->findLatest($page);\n-\n- return $this->render('blog/listing.html.twig', ['records' => $records]);\n- }\n/**\n* @Route(\"/posts/{slug}\", methods={\"GET\"}, name=\"blog_post\")\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Controller/FrontendController.php", "diff": "+<?php\n+/**\n+ *\n+ *\n+ * @author Bob den Otter <bobdenotter@gmail.com>\n+ */\n+\n+namespace Bolt\\Controller;\n+\n+\n+use Bolt\\Configuration\\Config;\n+use Bolt\\Entity\\Content;\n+use Bolt\\Repository\\ContentRepository;\n+use Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;\n+use Symfony\\Component\\HttpFoundation\\Request;\n+use Symfony\\Component\\HttpFoundation\\Response;\n+use Symfony\\Component\\Routing\\Annotation\\Route;\n+\n+class FrontendController extends AbstractController\n+{\n+ /** @var Config */\n+ private $config;\n+\n+ public function __construct(Config $config)\n+ {\n+ $this->config = $config;\n+ }\n+\n+ /**\n+ * @Route(\"/content\", methods={\"GET\"}, name=\"listing\")\n+ */\n+ public function contentListing(ContentRepository $content, Request $request): Response\n+ {\n+ $page = (int) $request->query->get('page', 1);\n+\n+ /** @var Content $records */\n+ $records = $content->findLatest($page);\n+\n+ return $this->render('blog/listing.html.twig', ['records' => $records]);\n+ }\n+\n+ /**\n+ * Renders a view.\n+ *\n+ * @final\n+ */\n+ protected function render(string $view, array $parameters = array(), Response $response = null): Response\n+ {\n+ $twig = $this->container->get('twig');\n+ $content = $twig->render($view, $parameters);\n+\n+ dump($this->config);\n+\n+ if ($response === null) {\n+ $response = new Response();\n+ }\n+\n+ $response->setContent($content);\n+\n+ return $response;\n+ }\n+}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "templates/blog/listing.html.twig", "new_path": "templates/blog/listing.html.twig", "diff": "{% if records.haveToPaginate %}\n<div class=\"navigation text-center\">\n- {{ pagerfanta(records, 'twitter_bootstrap3_translated', {routeName: 'content_listing', routeParams: app.request.query.all}) }}\n+ {{ pagerfanta(records, 'twitter_bootstrap3_translated', {routeName: 'listing', routeParams: app.request.query.all}) }}\n</div>\n{% endif %}\n" } ]
PHP
MIT License
bolt/core
Creating own frontendcontroller
95,144
18.09.2018 07:55:18
-7,200
2be5c1b0b41ec89cbc6271d636423c959a5084d0
Working on frontend controller
[ { "change_type": "MODIFY", "old_path": "src/Controller/FrontendController.php", "new_path": "src/Controller/FrontendController.php", "diff": "@@ -10,6 +10,7 @@ namespace Bolt\\Controller;\nuse Bolt\\Configuration\\Config;\nuse Bolt\\Entity\\Content;\nuse Bolt\\Repository\\ContentRepository;\n+use Bolt\\Repository\\FieldRepository;\nuse Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\n@@ -38,6 +39,29 @@ class FrontendController extends AbstractController\nreturn $this->render('listing.twig', ['records' => $records]);\n}\n+ /**\n+ * @Route(\"/{id<[1-9]\\d*>}\", methods={\"GET\"}, name=\"record_by_id\")\n+ * @Route(\"/{slug<[a-z0-9_-]+>}\", methods={\"GET\"}, name=\"record_by_slug\")\n+ */\n+ public function record(ContentRepository $contentRepository, FieldRepository $fieldRepository, $id = null, $slug = null): Response\n+ {\n+ if ($id) {\n+ $record = $contentRepository->findOneBy(['id' => $id]);\n+ } elseif ($slug) {\n+ $field = $fieldRepository->findOneBySlug($slug);\n+ $record = $field->getContent();\n+ }\n+\n+ $recordSlug = $record->getDefinition()->singular_slug;\n+\n+ $context = [\n+ 'record' => $record,\n+ $recordSlug => $record,\n+ ];\n+\n+ return $this->render('record.twig', $context);\n+ }\n+\n/**\n* Renders a view.\n*\n" }, { "change_type": "MODIFY", "old_path": "src/Repository/ContentRepository.php", "new_path": "src/Repository/ContentRepository.php", "diff": "@@ -24,18 +24,39 @@ class ContentRepository extends ServiceEntityRepository\nparent::__construct($registry, Content::class);\n}\n+ private function getQueryBuilder(QueryBuilder $qb = null)\n+ {\n+ return $qb ?: $this->createQueryBuilder('content');\n+ }\n+\npublic function findLatest(int $page = 1): Pagerfanta\n{\n- $qb = $this->createQueryBuilder('p')\n+ $qb = $this->getQueryBuilder()\n->addSelect('a')\n- ->innerJoin('p.author', 'a')\n- ->where('p.publishedAt <= :now')\n- ->orderBy('p.publishedAt', 'DESC')\n+ ->innerJoin('content.author', 'a')\n+ ->where('content.publishedAt <= :now')\n+ ->orderBy('content.publishedAt', 'DESC')\n->setParameter('now', new \\DateTime());\nreturn $this->createPaginator($qb->getQuery(), $page);\n}\n+ public function findOneBySlug(string $slug): ?Content\n+ {\n+ return $this->getQueryBuilder()\n+ ->join('Bolt\\Entity\\Field\\SlugField', 'field')\n+ ->andWhere('field.value = :slug')\n+ ->setParameter('slug', json_encode(array($slug)))\n+ ->getQuery()\n+ ->getOneOrNullResult()\n+ ;\n+\n+// ->join('m.PropertyEntity', 'p')\n+// ->where('p.value IN (:values)')\n+// ->setParameter('values',['red','yellow']);\n+ }\n+\n+\nprivate function createPaginator(Query $query, int $page): Pagerfanta\n{\n$paginator = new Pagerfanta(new DoctrineORMAdapter($query));\n" }, { "change_type": "MODIFY", "old_path": "src/Repository/FieldRepository.php", "new_path": "src/Repository/FieldRepository.php", "diff": "@@ -21,16 +21,31 @@ class FieldRepository extends ServiceEntityRepository\nparent::__construct($registry, Field::class);\n}\n+ private function getQueryBuilder(QueryBuilder $qb = null)\n+ {\n+ return $qb ?: $this->createQueryBuilder('field');\n+ }\n+\n+ public function findOneBySlug($slug): ?Field\n+ {\n+ return $this->getQueryBuilder()\n+ ->andWhere('field.value = :slug')\n+ ->setParameter('slug', \\GuzzleHttp\\json_encode([$slug]))\n+ ->getQuery()\n+ ->getOneOrNullResult()\n+ ;\n+ }\n+\n// /**\n// * @return Field[] Returns an array of Field objects\n// */\n/*\npublic function findByExampleField($value)\n{\n- return $this->createQueryBuilder('f')\n- ->andWhere('f.exampleField = :val')\n+ return $this->createQueryBuilder('field')\n+ ->andWhere('field.exampleField = :val')\n->setParameter('val', $value)\n- ->orderBy('f.id', 'ASC')\n+ ->orderBy('field.id', 'ASC')\n->setMaxResults(10)\n->getQuery()\n->getResult()\n@@ -38,15 +53,14 @@ class FieldRepository extends ServiceEntityRepository\n}\n*/\n- /*\npublic function findOneBySomeField($value): ?Field\n{\n- return $this->createQueryBuilder('f')\n- ->andWhere('f.exampleField = :val')\n+ return $this->createQueryBuilder('field')\n+ ->andWhere('field.exampleField = :val')\n->setParameter('val', $value)\n->getQuery()\n->getOneOrNullResult()\n;\n}\n- */\n+\n}\n" } ]
PHP
MIT License
bolt/core
Working on frontend controller
95,168
18.09.2018 23:12:46
-7,200
b43debb758a51b0e727156af76be9fb7b4172981
Print Records rows using Context component
[ { "change_type": "MODIFY", "old_path": "assets/js/Content.vue", "new_path": "assets/js/Content.vue", "diff": "<template>\n- <div class=\"card w-100 mt-2\">\n- <div class=\"card-body\">\n- {{ message }}\n- Print\n- </div>\n- </div>\n+ <tr>\n+ <td>{{ id }}</td>\n+ <td>{{ title.value.value }}</td>\n+ </tr>\n</template>\n<script>\nexport default {\n- name: 'content',\n- props: ['message'],\n+ name: 'context',\n+ props: [\n+ 'id',\n+ 'title'\n+ ],\n}\n</script>\n" } ]
PHP
MIT License
bolt/core
Print Records rows using Context component
95,168
18.09.2018 23:17:14
-7,200
f9e751bf29add2318a3e897c82247250de37c439
WIP Display latest Records per Contenttype
[ { "change_type": "MODIFY", "old_path": "assets/js/DashboardContentList.vue", "new_path": "assets/js/DashboardContentList.vue", "diff": "No content!\n</div>\n- <div v-else v-for=\"item in content\" :key=\"item.id\" class=\"row col\">\n- {{ item }}\n- <Content :message=\"item.id\"></Content>\n+ <div v-else>\n+ <h3>Latest {{ type }}</h3>\n+ <table>\n+ <tbody>\n+ <template v-for=\"item in content.slice(0, limit)\" class=\"row col\">\n+ <tr :key=\"item.id\">\n+ <td>{{ item.id }}</td>\n+ <td>{{ item.fields[0].value.value }}</td>\n+ </tr>\n+ <!-- Maybe is better to have a component to print each row? -->\n+ <!-- <Context :id=\"item.id\" :key=\"item.id\" :contenttype=\"content.contenttype\" :title=\"item.fields[0]\"></Context> -->\n+ </template>\n+ </tbody>\n+ </table>\n</div>\n</div>\n</template>\n<script>\n- import Content from './Content';\n+ import Context from './Content';\nexport default {\n- name: 'content',\n+ name: 'context',\nprops: [\n'type',\n'limit',\n],\ncomponents: {\n- Content\n+ Context\n},\ndata () {\nreturn {\nreturn this.$store.getters['content/content'];\n},\n},\n- methods: {\n- createContent () {\n- this.$store.dispatch('content/createContent', this.$data.message)\n- .then(() => this.$data.message = '')\n- },\n- },\n}\n</script>\n" } ]
PHP
MIT License
bolt/core
WIP Display latest Records per Contenttype
95,144
19.09.2018 15:58:10
-7,200
ec4a74060c25ee65b0e089035f34a6214d56f770
Tweaking template
[ { "change_type": "MODIFY", "old_path": "public/theme/skeleton/record.twig", "new_path": "public/theme/skeleton/record.twig", "diff": "{{ block('sub_fields', 'partials/_sub_fields.twig') }}\n{% endwith %}\n+ <p>Record:</p>\n+ <code>{% verbatim %}{{ dump(record.definition) }}{% endverbatim %}</code>\n+\n+ {{ dump(record.definition) }}\n+\n+ <p>Field:</p>\n+ <code>{% verbatim %}{{ dump(record.image.definition) }}{% endverbatim %}</code>\n+ {{ dump(record.image.definition) }}\n+\n{# Uncomment this if you wish to dump the entire record to the client, for debugging purposes.\n{{ dump(record) }}\n#}\n" } ]
PHP
MIT License
bolt/core
Tweaking template
95,144
19.09.2018 16:48:11
-7,200
6a8fbba7d0c83b558c024927d98144eea06f4e7e
Adding a rudimentary thumbnailer
[ { "change_type": "MODIFY", "old_path": "composer.json", "new_path": "composer.json", "diff": "\"ezyang/htmlpurifier\": \"^4.10\",\n\"fzaninotto/faker\": \"^1.8\",\n\"guzzlehttp/guzzle\": \"^6.3\",\n+ \"league/glide-symfony\": \"^1.0\",\n\"sensio/framework-extra-bundle\": \"^5.1\",\n\"sensiolabs/security-checker\": \"^4.1\",\n\"symfony/asset\": \"^4.1\",\n\"symfony/flex\": \"^1.1\",\n\"symfony/form\": \"^4.1\",\n\"symfony/framework-bundle\": \"^4.1\",\n- \"symfony/lts\": \"^4@dev\",\n\"symfony/orm-pack\": \"^1.0\",\n\"symfony/polyfill-php72\": \"^1.8\",\n\"symfony/security-bundle\": \"^4.1\",\n" }, { "change_type": "MODIFY", "old_path": "composer.lock", "new_path": "composer.lock", "diff": "\"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies\",\n\"This file is @generated automatically\"\n],\n- \"content-hash\": \"572c326c6fa2a27ecf0ece443a24a1c2\",\n+ \"content-hash\": \"6f2dbec8c73ded7034727d7a22bc5c12\",\n\"packages\": [\n{\n\"name\": \"bolt/collection\",\n],\n\"time\": \"2017-03-20T17:10:46+00:00\"\n},\n+ {\n+ \"name\": \"intervention/image\",\n+ \"version\": \"2.4.2\",\n+ \"source\": {\n+ \"type\": \"git\",\n+ \"url\": \"https://github.com/Intervention/image.git\",\n+ \"reference\": \"e82d274f786e3d4b866a59b173f42e716f0783eb\"\n+ },\n+ \"dist\": {\n+ \"type\": \"zip\",\n+ \"url\": \"https://api.github.com/repos/Intervention/image/zipball/e82d274f786e3d4b866a59b173f42e716f0783eb\",\n+ \"reference\": \"e82d274f786e3d4b866a59b173f42e716f0783eb\",\n+ \"shasum\": \"\"\n+ },\n+ \"require\": {\n+ \"ext-fileinfo\": \"*\",\n+ \"guzzlehttp/psr7\": \"~1.1\",\n+ \"php\": \">=5.4.0\"\n+ },\n+ \"require-dev\": {\n+ \"mockery/mockery\": \"~0.9.2\",\n+ \"phpunit/phpunit\": \"^4.8 || ^5.7\"\n+ },\n+ \"suggest\": {\n+ \"ext-gd\": \"to use GD library based image processing.\",\n+ \"ext-imagick\": \"to use Imagick based image processing.\",\n+ \"intervention/imagecache\": \"Caching extension for the Intervention Image library\"\n+ },\n+ \"type\": \"library\",\n+ \"extra\": {\n+ \"branch-alias\": {\n+ \"dev-master\": \"2.4-dev\"\n+ },\n+ \"laravel\": {\n+ \"providers\": [\n+ \"Intervention\\\\Image\\\\ImageServiceProvider\"\n+ ],\n+ \"aliases\": {\n+ \"Image\": \"Intervention\\\\Image\\\\Facades\\\\Image\"\n+ }\n+ }\n+ },\n+ \"autoload\": {\n+ \"psr-4\": {\n+ \"Intervention\\\\Image\\\\\": \"src/Intervention/Image\"\n+ }\n+ },\n+ \"notification-url\": \"https://packagist.org/downloads/\",\n+ \"license\": [\n+ \"MIT\"\n+ ],\n+ \"authors\": [\n+ {\n+ \"name\": \"Oliver Vogel\",\n+ \"email\": \"oliver@olivervogel.com\",\n+ \"homepage\": \"http://olivervogel.com/\"\n+ }\n+ ],\n+ \"description\": \"Image handling and manipulation library with support for Laravel integration\",\n+ \"homepage\": \"http://image.intervention.io/\",\n+ \"keywords\": [\n+ \"gd\",\n+ \"image\",\n+ \"imagick\",\n+ \"laravel\",\n+ \"thumbnail\",\n+ \"watermark\"\n+ ],\n+ \"time\": \"2018-05-29T14:19:03+00:00\"\n+ },\n{\n\"name\": \"jdorn/sql-formatter\",\n\"version\": \"v1.2.17\",\n],\n\"time\": \"2014-01-12T16:20:24+00:00\"\n},\n+ {\n+ \"name\": \"league/flysystem\",\n+ \"version\": \"1.0.47\",\n+ \"source\": {\n+ \"type\": \"git\",\n+ \"url\": \"https://github.com/thephpleague/flysystem.git\",\n+ \"reference\": \"a11e4a75f256bdacf99d20780ce42d3b8272975c\"\n+ },\n+ \"dist\": {\n+ \"type\": \"zip\",\n+ \"url\": \"https://api.github.com/repos/thephpleague/flysystem/zipball/a11e4a75f256bdacf99d20780ce42d3b8272975c\",\n+ \"reference\": \"a11e4a75f256bdacf99d20780ce42d3b8272975c\",\n+ \"shasum\": \"\"\n+ },\n+ \"require\": {\n+ \"ext-fileinfo\": \"*\",\n+ \"php\": \">=5.5.9\"\n+ },\n+ \"conflict\": {\n+ \"league/flysystem-sftp\": \"<1.0.6\"\n+ },\n+ \"require-dev\": {\n+ \"phpspec/phpspec\": \"^3.4\",\n+ \"phpunit/phpunit\": \"^5.7.10\"\n+ },\n+ \"suggest\": {\n+ \"ext-fileinfo\": \"Required for MimeType\",\n+ \"ext-ftp\": \"Allows you to use FTP server storage\",\n+ \"ext-openssl\": \"Allows you to use FTPS server storage\",\n+ \"league/flysystem-aws-s3-v2\": \"Allows you to use S3 storage with AWS SDK v2\",\n+ \"league/flysystem-aws-s3-v3\": \"Allows you to use S3 storage with AWS SDK v3\",\n+ \"league/flysystem-azure\": \"Allows you to use Windows Azure Blob storage\",\n+ \"league/flysystem-cached-adapter\": \"Flysystem adapter decorator for metadata caching\",\n+ \"league/flysystem-eventable-filesystem\": \"Allows you to use EventableFilesystem\",\n+ \"league/flysystem-rackspace\": \"Allows you to use Rackspace Cloud Files\",\n+ \"league/flysystem-sftp\": \"Allows you to use SFTP server storage via phpseclib\",\n+ \"league/flysystem-webdav\": \"Allows you to use WebDAV storage\",\n+ \"league/flysystem-ziparchive\": \"Allows you to use ZipArchive adapter\",\n+ \"spatie/flysystem-dropbox\": \"Allows you to use Dropbox storage\",\n+ \"srmklive/flysystem-dropbox-v2\": \"Allows you to use Dropbox storage for PHP 5 applications\"\n+ },\n+ \"type\": \"library\",\n+ \"extra\": {\n+ \"branch-alias\": {\n+ \"dev-master\": \"1.1-dev\"\n+ }\n+ },\n+ \"autoload\": {\n+ \"psr-4\": {\n+ \"League\\\\Flysystem\\\\\": \"src/\"\n+ }\n+ },\n+ \"notification-url\": \"https://packagist.org/downloads/\",\n+ \"license\": [\n+ \"MIT\"\n+ ],\n+ \"authors\": [\n+ {\n+ \"name\": \"Frank de Jonge\",\n+ \"email\": \"info@frenky.net\"\n+ }\n+ ],\n+ \"description\": \"Filesystem abstraction: Many filesystems, one API.\",\n+ \"keywords\": [\n+ \"Cloud Files\",\n+ \"WebDAV\",\n+ \"abstraction\",\n+ \"aws\",\n+ \"cloud\",\n+ \"copy.com\",\n+ \"dropbox\",\n+ \"file systems\",\n+ \"files\",\n+ \"filesystem\",\n+ \"filesystems\",\n+ \"ftp\",\n+ \"rackspace\",\n+ \"remote\",\n+ \"s3\",\n+ \"sftp\",\n+ \"storage\"\n+ ],\n+ \"time\": \"2018-09-14T15:30:29+00:00\"\n+ },\n+ {\n+ \"name\": \"league/glide\",\n+ \"version\": \"1.3.0\",\n+ \"source\": {\n+ \"type\": \"git\",\n+ \"url\": \"https://github.com/thephpleague/glide.git\",\n+ \"reference\": \"bd29f65c9666abd72e66916e0573801e435ca878\"\n+ },\n+ \"dist\": {\n+ \"type\": \"zip\",\n+ \"url\": \"https://api.github.com/repos/thephpleague/glide/zipball/bd29f65c9666abd72e66916e0573801e435ca878\",\n+ \"reference\": \"bd29f65c9666abd72e66916e0573801e435ca878\",\n+ \"shasum\": \"\"\n+ },\n+ \"require\": {\n+ \"intervention/image\": \"^2.1\",\n+ \"league/flysystem\": \"^1.0\",\n+ \"php\": \"^5.4 | ^7.0\",\n+ \"psr/http-message\": \"^1.0\"\n+ },\n+ \"require-dev\": {\n+ \"mockery/mockery\": \"~0.9\",\n+ \"phpunit/php-token-stream\": \"^1.4\",\n+ \"phpunit/phpunit\": \"~4.4\"\n+ },\n+ \"type\": \"library\",\n+ \"extra\": {\n+ \"branch-alias\": {\n+ \"dev-master\": \"1.1-dev\"\n+ }\n+ },\n+ \"autoload\": {\n+ \"psr-4\": {\n+ \"League\\\\Glide\\\\\": \"src/\"\n+ }\n+ },\n+ \"notification-url\": \"https://packagist.org/downloads/\",\n+ \"license\": [\n+ \"MIT\"\n+ ],\n+ \"authors\": [\n+ {\n+ \"name\": \"Jonathan Reinink\",\n+ \"email\": \"jonathan@reinink.ca\",\n+ \"homepage\": \"http://reinink.ca\"\n+ }\n+ ],\n+ \"description\": \"Wonderfully easy on-demand image manipulation library with an HTTP based API.\",\n+ \"homepage\": \"http://glide.thephpleague.com\",\n+ \"keywords\": [\n+ \"ImageMagick\",\n+ \"editing\",\n+ \"gd\",\n+ \"image\",\n+ \"imagick\",\n+ \"league\",\n+ \"manipulation\",\n+ \"processing\"\n+ ],\n+ \"time\": \"2018-02-12T23:28:25+00:00\"\n+ },\n+ {\n+ \"name\": \"league/glide-symfony\",\n+ \"version\": \"1.0.3\",\n+ \"source\": {\n+ \"type\": \"git\",\n+ \"url\": \"https://github.com/thephpleague/glide-symfony.git\",\n+ \"reference\": \"94b43e1d34e6be11f2996254d33748f4da123ec5\"\n+ },\n+ \"dist\": {\n+ \"type\": \"zip\",\n+ \"url\": \"https://api.github.com/repos/thephpleague/glide-symfony/zipball/94b43e1d34e6be11f2996254d33748f4da123ec5\",\n+ \"reference\": \"94b43e1d34e6be11f2996254d33748f4da123ec5\",\n+ \"shasum\": \"\"\n+ },\n+ \"require\": {\n+ \"league/glide\": \"^1.0\",\n+ \"symfony/http-foundation\": \"^2.3|^3.0|^4.0\"\n+ },\n+ \"require-dev\": {\n+ \"mockery/mockery\": \"^0.9\",\n+ \"phpunit/phpunit\": \"^4.0\"\n+ },\n+ \"type\": \"library\",\n+ \"autoload\": {\n+ \"psr-4\": {\n+ \"League\\\\Glide\\\\\": \"src/\"\n+ }\n+ },\n+ \"notification-url\": \"https://packagist.org/downloads/\",\n+ \"license\": [\n+ \"MIT\"\n+ ],\n+ \"authors\": [\n+ {\n+ \"name\": \"Jonathan Reinink\",\n+ \"email\": \"jonathan@reinink.ca\",\n+ \"homepage\": \"http://reinink.ca\"\n+ }\n+ ],\n+ \"description\": \"Glide adapter for Symfony\",\n+ \"homepage\": \"http://glide.thephpleague.com\",\n+ \"time\": \"2018-02-10T14:10:07+00:00\"\n+ },\n{\n\"name\": \"monolog/monolog\",\n\"version\": \"1.23.0\",\n],\n\"time\": \"2018-08-01T08:24:03+00:00\"\n},\n- {\n- \"name\": \"symfony/lts\",\n- \"version\": \"dev-master\",\n- \"conflict\": {\n- \"symfony/asset\": \">=5\",\n- \"symfony/browser-kit\": \">=5\",\n- \"symfony/cache\": \">=5\",\n- \"symfony/class-loader\": \">=5\",\n- \"symfony/config\": \">=5\",\n- \"symfony/console\": \">=5\",\n- \"symfony/css-selector\": \">=5\",\n- \"symfony/debug\": \">=5\",\n- \"symfony/debug-bundle\": \">=5\",\n- \"symfony/dependency-injection\": \">=5\",\n- \"symfony/doctrine-bridge\": \">=5\",\n- \"symfony/dom-crawler\": \">=5\",\n- \"symfony/dotenv\": \">=5\",\n- \"symfony/event-dispatcher\": \">=5\",\n- \"symfony/expression-language\": \">=5\",\n- \"symfony/filesystem\": \">=5\",\n- \"symfony/finder\": \">=5\",\n- \"symfony/form\": \">=5\",\n- \"symfony/framework-bundle\": \">=5\",\n- \"symfony/http-foundation\": \">=5\",\n- \"symfony/http-kernel\": \">=5\",\n- \"symfony/inflector\": \">=5\",\n- \"symfony/intl\": \">=5\",\n- \"symfony/ldap\": \">=5\",\n- \"symfony/lock\": \">=5\",\n- \"symfony/messenger\": \">=5\",\n- \"symfony/monolog-bridge\": \">=5\",\n- \"symfony/options-resolver\": \">=5\",\n- \"symfony/process\": \">=5\",\n- \"symfony/property-access\": \">=5\",\n- \"symfony/property-info\": \">=5\",\n- \"symfony/proxy-manager-bridge\": \">=5\",\n- \"symfony/routing\": \">=5\",\n- \"symfony/security\": \">=5\",\n- \"symfony/security-bundle\": \">=5\",\n- \"symfony/security-core\": \">=5\",\n- \"symfony/security-csrf\": \">=5\",\n- \"symfony/security-guard\": \">=5\",\n- \"symfony/security-http\": \">=5\",\n- \"symfony/serializer\": \">=5\",\n- \"symfony/stopwatch\": \">=5\",\n- \"symfony/symfony\": \">=5\",\n- \"symfony/templating\": \">=5\",\n- \"symfony/translation\": \">=5\",\n- \"symfony/twig-bridge\": \">=5\",\n- \"symfony/twig-bundle\": \">=5\",\n- \"symfony/validator\": \">=5\",\n- \"symfony/var-dumper\": \">=5\",\n- \"symfony/web-link\": \">=5\",\n- \"symfony/web-profiler-bundle\": \">=5\",\n- \"symfony/web-server-bundle\": \">=5\",\n- \"symfony/workflow\": \">=5\",\n- \"symfony/yaml\": \">=5\"\n- },\n- \"type\": \"metapackage\",\n- \"extra\": {\n- \"branch-alias\": {\n- \"dev-master\": \"4-dev\"\n- }\n- },\n- \"notification-url\": \"https://packagist.org/downloads/\",\n- \"license\": [\n- \"MIT\"\n- ],\n- \"authors\": [\n- {\n- \"name\": \"Fabien Potencier\",\n- \"email\": \"fabien@symfony.com\"\n- },\n- {\n- \"name\": \"Symfony Community\",\n- \"homepage\": \"https://symfony.com/contributors\"\n- }\n- ],\n- \"description\": \"Enforces Long Term Supported versions of Symfony components\",\n- \"homepage\": \"https://symfony.com\",\n- \"abandoned\": \"symfony/flex\",\n- \"time\": \"2018-09-13T17:13:03+00:00\"\n- },\n{\n\"name\": \"symfony/monolog-bridge\",\n\"version\": \"v4.1.4\",\n},\n{\n\"name\": \"nikic/php-parser\",\n- \"version\": \"v4.0.3\",\n+ \"version\": \"v4.0.4\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/nikic/PHP-Parser.git\",\n- \"reference\": \"bd088dc940a418f09cda079a9b5c7c478890fb8d\"\n+ \"reference\": \"fa6ee28600d21d49b2b4e1006b48426cec8e579c\"\n},\n\"dist\": {\n\"type\": \"zip\",\n- \"url\": \"https://api.github.com/repos/nikic/PHP-Parser/zipball/bd088dc940a418f09cda079a9b5c7c478890fb8d\",\n- \"reference\": \"bd088dc940a418f09cda079a9b5c7c478890fb8d\",\n+ \"url\": \"https://api.github.com/repos/nikic/PHP-Parser/zipball/fa6ee28600d21d49b2b4e1006b48426cec8e579c\",\n+ \"reference\": \"fa6ee28600d21d49b2b4e1006b48426cec8e579c\",\n\"shasum\": \"\"\n},\n\"require\": {\n\"parser\",\n\"php\"\n],\n- \"time\": \"2018-07-15T17:25:16+00:00\"\n+ \"time\": \"2018-09-18T07:03:24+00:00\"\n},\n{\n\"name\": \"php-cs-fixer/diff\",\n],\n\"aliases\": [],\n\"minimum-stability\": \"beta\",\n- \"stability-flags\": {\n- \"symfony/lts\": 20\n- },\n+ \"stability-flags\": [],\n\"prefer-stable\": true,\n\"prefer-lowest\": false,\n\"platform\": {\n" }, { "change_type": "ADD", "old_path": "public/files/hal.jpg", "new_path": "public/files/hal.jpg", "diff": "Binary files /dev/null and b/public/files/hal.jpg differ\n" }, { "change_type": "ADD", "old_path": "public/files/vlinders.jpg", "new_path": "public/files/vlinders.jpg", "diff": "Binary files /dev/null and b/public/files/vlinders.jpg differ\n" }, { "change_type": "MODIFY", "old_path": "src/Configuration/Config.php", "new_path": "src/Configuration/Config.php", "diff": "@@ -106,9 +106,9 @@ class Config\n*\n* @return string\n*/\n- public function path(string $path, bool $absolute = true): string\n+ public function path(string $path, bool $absolute = true, string $additional = ''): string\n{\n- return $this->pathResolver->resolve($path, $absolute);\n+ return $this->pathResolver->resolve($path, $absolute, $additional);\n}\n/**\n@@ -611,7 +611,6 @@ class Config\nif (Path::isRelative($path)) {\n$path = $pathResolver->resolve($path);\n}\n- dump($path);\n// If path has filename with extension, use that\nif (Path::hasExtension($path)) {\n" }, { "change_type": "MODIFY", "old_path": "src/Configuration/PathResolver.php", "new_path": "src/Configuration/PathResolver.php", "diff": "@@ -96,7 +96,7 @@ class PathResolver\n*\n* @return string\n*/\n- public function resolve(string $path, bool $absolute = true): string\n+ public function resolve(string $path, bool $absolute = true, string $additional = ''): string\n{\nif (isset($this->paths[$path])) {\n$path = $this->paths[$path];\n@@ -128,8 +128,12 @@ class PathResolver\n$path = Path::makeAbsolute($path, $this->paths['root']);\n}\n- // Not necessary, could remove.\n- $path = Path::canonicalize($path);\n+ if ($additional !== '') {\n+ $path .= '/' . $additional;\n+ }\n+\n+ // Make sure we don't have lingering unneeded dir-seperators\n+ $path = Path::canonicalize($path . $additional);\nreturn $path;\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Controller/ImageController.php", "diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\Controller;\n+\n+use Bolt\\Configuration\\Config;\n+use League\\Glide\\Responses\\SymfonyResponseFactory;\n+use League\\Glide\\ServerFactory;\n+use Symfony\\Component\\Routing\\Annotation\\Route;\n+\n+class ImageController\n+{\n+ private $config;\n+\n+ public function __construct(Config $config)\n+ {\n+ $this->config = $config;\n+ }\n+\n+ /**\n+ * @Route(\"/thumbs/{filename}\", methods={\"GET\"}, name=\"thumbnail\")\n+ */\n+ public function image(string $filename)\n+ {\n+ $server = ServerFactory::create([\n+ 'response' => new SymfonyResponseFactory(),\n+ 'source' => $this->config->path('files'),\n+ 'cache' => $this->config->path('cache', true, 'thumbnails'),\n+ ]);\n+\n+ $server->outputImage($filename, $_GET);\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/ContentMagicTraits.php", "new_path": "src/Entity/ContentMagicTraits.php", "diff": "<?php\n-/**\n- *\n- *\n- * @author Bob den Otter <bobdenotter@gmail.com>\n- */\n-\n-namespace Bolt\\Entity;\n+declare(strict_types=1);\n-use Symfony\\Component\\Routing\\Generator\\UrlGenerator;\n-use Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface;\n+namespace Bolt\\Entity;\ntrait ContentMagicTraits\n{\n@@ -48,6 +41,7 @@ trait ContentMagicTraits\n/**\n* @param string $name\n* @param array $arguments\n+ *\n* @return mixed\n*/\npublic function magic(string $name, array $arguments = [])\n@@ -62,6 +56,7 @@ trait ContentMagicTraits\n/**\n* @param string $name\n* @param array $arguments\n+ *\n* @return mixed\n*/\npublic function get(string $name, array $arguments = [])\n@@ -89,24 +84,26 @@ trait ContentMagicTraits\npublic function magicTitle()\n{\n- return \"magic title\";\n+ return 'magic title';\n}\npublic function magicImage()\n{\n- return \"magic image\";\n+ return 'magic image';\n}\npublic function magicExcerpt()\n{\n- return \"magic excerpt\";\n+ return 'magic excerpt';\n}\n- public function magicPrevious() {\n- return \"magic previous\";\n+ public function magicPrevious()\n+ {\n+ return 'magic previous';\n}\n- public function magicNext() {\n- return \"magic next\";\n+ public function magicNext()\n+ {\n+ return 'magic next';\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Repository/ContentRepository.php", "new_path": "src/Repository/ContentRepository.php", "diff": "@@ -46,7 +46,7 @@ class ContentRepository extends ServiceEntityRepository\nreturn $this->getQueryBuilder()\n->innerJoin('Bolt\\Entity\\Field\\SlugField', 'field')\n->andWhere('field.value = :slug')\n- ->setParameter('slug', json_encode(array($slug)))\n+ ->setParameter('slug', json_encode([$slug]))\n->getQuery()\n->getResult()\n;\n@@ -56,7 +56,6 @@ class ContentRepository extends ServiceEntityRepository\n// ->setParameter('values',['red','yellow']);\n}\n-\nprivate function createPaginator(Query $query, int $page): Pagerfanta\n{\n$paginator = new Pagerfanta(new DoctrineORMAdapter($query));\n" }, { "change_type": "MODIFY", "old_path": "src/Repository/FieldRepository.php", "new_path": "src/Repository/FieldRepository.php", "diff": "@@ -62,5 +62,4 @@ class FieldRepository extends ServiceEntityRepository\n->getOneOrNullResult()\n;\n}\n-\n}\n" }, { "change_type": "MODIFY", "old_path": "symfony.lock", "new_path": "symfony.lock", "diff": "\"guzzlehttp/psr7\": {\n\"version\": \"1.4.2\"\n},\n+ \"intervention/image\": {\n+ \"version\": \"2.4.2\"\n+ },\n\"jdorn/sql-formatter\": {\n\"version\": \"v1.2.17\"\n},\n+ \"league/flysystem\": {\n+ \"version\": \"1.0.47\"\n+ },\n+ \"league/glide\": {\n+ \"version\": \"1.3.0\"\n+ },\n+ \"league/glide-symfony\": {\n+ \"version\": \"1.0.3\"\n+ },\n\"monolog/monolog\": {\n\"version\": \"1.23.0\"\n},\n\"symfony/intl\": {\n\"version\": \"v3.4.0-beta2\"\n},\n- \"symfony/lts\": {\n- \"version\": \"4-dev\"\n- },\n\"symfony/maker-bundle\": {\n\"version\": \"1.0\",\n\"recipe\": {\n" } ]
PHP
MIT License
bolt/core
Adding a rudimentary thumbnailer
95,144
19.09.2018 16:56:19
-7,200
41ceb1e6c1eb2d3455755c384282efd3bcc3833b
Use proper response instead
[ { "change_type": "MODIFY", "old_path": "src/Controller/ImageController.php", "new_path": "src/Controller/ImageController.php", "diff": "@@ -29,6 +29,9 @@ class ImageController\n'cache' => $this->config->path('cache', true, 'thumbnails'),\n]);\n- $server->outputImage($filename, $_GET);\n+ /** @var StreamedResponse $response */\n+ $response = $server->getImageResponse($filename, $_GET);\n+\n+ return $response;\n}\n}\n" } ]
PHP
MIT License
bolt/core
Use proper response instead
95,144
20.09.2018 17:32:48
-7,200
5d38a4fa379089cb971d8186ae5990616052e12f
Working on images/thumbnails
[ { "change_type": "MODIFY", "old_path": "config/bolt/config.yaml", "new_path": "config/bolt/config.yaml", "diff": "@@ -13,6 +13,9 @@ database:\nsitename: A sample site in CONFIG\npayoff: The amazing payoff goes here\n+# note: ENV vars do not get parsed, yet!\n+secret: '%env(APP_SECRET)%'\n+\n# The theme to use.\n#\n# Don't edit the provided templates directly, because they _will_ get updated\n" }, { "change_type": "ADD", "old_path": "public/files/kitten.jpg", "new_path": "public/files/kitten.jpg", "diff": "Binary files /dev/null and b/public/files/kitten.jpg differ\n" }, { "change_type": "MODIFY", "old_path": "public/theme/skeleton/record.twig", "new_path": "public/theme/skeleton/record.twig", "diff": "<h1>{{ record.title }}</h1>\n+<hr>\n+ {% if record.image %}\n+ {{ dump(record.image) }}\n+ <p>{{ record.image }}</p>\n+ {{ thumbnail(record.image, 400, 260) }}\n+<hr>\n+ <a href=\"{{ record.image }}\">\n+ <img src=\"{{ thumbnail(record.image, 400, 260) }}\">\n+ <img src=\"{{ record.image|thumbnail(400, 260) }}\">\n+ </a>\n+ {% endif %}\n+\n+ <hr>\n+\n{# Output all fields, in the order as defined in the contenttype.\nTo change the generated html and configure the options, see:\nhttps://docs.bolt.cm/templating #}\n<p>Record:</p>\n<code>{% verbatim %}{{ dump(record.definition) }}{% endverbatim %}</code>\n- {{ dump(record.definition) }}\n+ {#{{ dump(record.definition) }}#}\n<p>Field:</p>\n<code>{% verbatim %}{{ dump(record.image.definition) }}{% endverbatim %}</code>\n- {{ dump(record.image.definition) }}\n+ {#{{ dump(record.image.definition) }}#}\n{# Uncomment this if you wish to dump the entire record to the client, for debugging purposes.\n{{ dump(record) }}\n" }, { "change_type": "MODIFY", "old_path": "src/Configuration/PathResolver.php", "new_path": "src/Configuration/PathResolver.php", "diff": "@@ -133,7 +133,7 @@ class PathResolver\n}\n// Make sure we don't have lingering unneeded dir-seperators\n- $path = Path::canonicalize($path . $additional);\n+ $path = Path::canonicalize($path);\nreturn $path;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/FrontendController.php", "new_path": "src/Controller/FrontendController.php", "diff": "<?php\ndeclare(strict_types=1);\n-/**\n- * @author Bob den Otter <bobdenotter@gmail.com>\n- */\nnamespace Bolt\\Controller;\n@@ -42,6 +39,11 @@ class FrontendController extends AbstractController\n/**\n* @Route(\"/record/{id<[1-9]\\d*>}\", methods={\"GET\"}, name=\"record_by_id\")\n* @Route(\"/record/{slug<[a-z0-9_-]+>}\", methods={\"GET\"}, name=\"record\")\n+ * @param ContentRepository $contentRepository\n+ * @param FieldRepository $fieldRepository\n+ * @param null $id\n+ * @param null $slug\n+ * @return Response\n*/\npublic function record(ContentRepository $contentRepository, FieldRepository $fieldRepository, $id = null, $slug = null): Response\n{\n@@ -67,6 +69,10 @@ class FrontendController extends AbstractController\n* Renders a view.\n*\n* @final\n+ * @param string $view\n+ * @param array $parameters\n+ * @param Response|null $response\n+ * @return Response\n*/\nprotected function render(string $view, array $parameters = [], Response $response = null): Response\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/Content.php", "new_path": "src/Entity/Content.php", "diff": "@@ -89,6 +89,9 @@ class Content\n/** @var UrlGeneratorInterface */\nprivate $urlGenerator;\n+ /** @var Config */\n+ private $config;\n+\npublic function __construct()\n{\n$this->createdAt = new \\DateTime();\n@@ -108,10 +111,14 @@ class Content\n*/\npublic function setConfig(Config $config)\n{\n- /** @var Bag $contentTypes */\n- $contentTypes = $config->get('contenttypes');\n+ $this->config = $config;\n+\n+ $this->contentTypeDefinition = ContentTypeFactory::get($this->contentType, $config->get('contenttypes'));\n+ }\n- $this->contentTypeDefinition = ContentTypeFactory::get($this->contentType, $contentTypes);\n+ public function getConfig(): Config\n+ {\n+ return $this->config;\n}\n/**\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/Field.php", "new_path": "src/Entity/Field.php", "diff": "@@ -143,6 +143,11 @@ class Field\nreturn $this->getDefinition()->type;\n}\n+ public function get($key)\n+ {\n+ return $this->value[$key];\n+ }\n+\npublic function getValue(): ?array\n{\nreturn $this->value;\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/Field/ImageField.php", "new_path": "src/Entity/Field/ImageField.php", "diff": "@@ -12,4 +12,12 @@ use Doctrine\\ORM\\Mapping as ORM;\n*/\nclass ImageField extends Field\n{\n+ public function __toString(): string\n+ {\n+ $config = $this->getContent()->getConfig();\n+\n+ $path = $config->path('files', false, $this->get('filename'));\n+\n+ return $path;\n+ }\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Twig/ImageExtension.php", "diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\Twig;\n+\n+use Bolt\\Configuration\\Config;\n+use Bolt\\Entity\\Field;\n+use Bolt\\Utils\\Markdown;\n+use League\\Glide\\Urls\\UrlBuilderFactory;\n+use Symfony\\Component\\Intl\\Intl;\n+use Twig\\Extension\\AbstractExtension;\n+use Twig\\TwigFilter;\n+use Twig\\TwigFunction;\n+\n+class ImageExtension extends AbstractExtension\n+{\n+ private $key;\n+\n+ private $config;\n+\n+ public function __construct(Config $config)\n+ {\n+ $this->key = 'foo';\n+ $this->config = $config;\n+ }\n+\n+ /**\n+ * {@inheritdoc}\n+ */\n+ public function getFilters(): array\n+ {\n+ return [\n+ new TwigFilter('showimage', [$this, 'dummy']),\n+ new TwigFilter('thumbnail', [$this, 'thumbnail'], ['is_safe' => ['html']]),\n+ ];\n+ }\n+\n+ /**\n+ * {@inheritdoc}\n+ */\n+ public function getFunctions(): array\n+ {\n+ return [\n+ new TwigFunction('image', [$this, 'dummy'], ['is_safe' => ['html']]),\n+ new TwigFunction('thumbnail', [$this, 'thumbnail'], ['is_safe' => ['html']]),\n+ new TwigFunction('popup', [$this, 'dummy'], ['is_safe' => ['html']]),\n+ ];\n+ }\n+\n+ public function thumbnail($image, $width, $height)\n+ {\n+ if ($image instanceof Field) {\n+ $filename = $image->get('filename');\n+ } else if (is_string($image)) {\n+ $filename = $image;\n+ }\n+\n+ $secret = $this->config->get('general/secret');\n+\n+ // Create an instance of the URL builder\n+ $urlBuilder = UrlBuilderFactory::create('/files/', $secret);\n+\n+ // Generate a URL\n+ $url = $urlBuilder->getUrl($filename, ['w' => 500]);\n+\n+ return $url;\n+ }\n+\n+ public function dummy($input = null)\n+ {\n+ return $input;\n+ }\n+\n+}\n" } ]
PHP
MIT License
bolt/core
Working on images/thumbnails
95,144
20.09.2018 20:04:29
-7,200
b2e519158868250041b82fca85e568478642a582
Replace missing setType
[ { "change_type": "MODIFY", "old_path": "src/Entity/Field.php", "new_path": "src/Entity/Field.php", "diff": "@@ -143,6 +143,13 @@ class Field\nreturn $this->getDefinition()->type;\n}\n+ public function setType(string $type): self\n+ {\n+ $this->type = $type;\n+\n+ return $this;\n+ }\n+\npublic function get($key)\n{\nreturn $this->value[$key];\n" } ]
PHP
MIT License
bolt/core
Replace missing setType
95,144
21.09.2018 14:55:28
-7,200
ef7e82d989b5cdf3ecd5157514b3fa021cf4847b
Fix fixtures to create correct fields.
[ { "change_type": "ADD", "old_path": null, "new_path": "src/Content/FieldFactory.php", "diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\Content;\n+\n+use Bolt\\Entity\\Field;\n+\n+final class FieldFactory\n+{\n+ public function __construct()\n+ {\n+ }\n+\n+ /**\n+ * @param string $name\n+ * @return Field\n+ */\n+ public static function get(string $name)\n+ {\n+ $classname = '\\\\Bolt\\\\Entity\\\\Field\\\\'. $name .'Field';\n+ if (class_exists($classname)) {\n+ $field = new $classname;\n+ } else {\n+ $field = new Field();\n+ }\n+\n+ return $field;\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "src/DataFixtures/ContentFixtures.php", "new_path": "src/DataFixtures/ContentFixtures.php", "diff": "@@ -5,6 +5,7 @@ declare(strict_types=1);\nnamespace Bolt\\DataFixtures;\nuse Bolt\\Configuration\\Config;\n+use Bolt\\Content\\FieldFactory;\nuse Bolt\\Entity\\Content;\nuse Bolt\\Entity\\Field;\nuse Bolt\\Entity\\User;\n@@ -86,9 +87,8 @@ class ContentFixtures extends Fixture\n$sortorder = 1;\nforeach ($contentType->fields as $name => $fieldType) {\n- $field = new Field();\n+ $field = FieldFactory::get($fieldType['type']);\n$field->setName($name);\n- $field->setType($fieldType['type']);\n$field->setValue($this->getValuesforFieldType($fieldType));\n$field->setSortorder($sortorder++ * 5);\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/Field.php", "new_path": "src/Entity/Field.php", "diff": "@@ -14,7 +14,7 @@ use Doctrine\\ORM\\Mapping as ORM;\n* @ORM\\InheritanceType(\"SINGLE_TABLE\")\n* @ORM\\DiscriminatorColumn(name=\"type\", type=\"string\")\n* @ORM\\DiscriminatorMap({\n- * \"text\" = \"Bolt\\Entity\\Field\\TextField\",\n+ * \"generic\" = \"field\",\n* \"block\" = \"Bolt\\Entity\\Field\\BlockField\",\n* \"checkbox\" = \"Bolt\\Entity\\Field\\CheckboxField\",\n* \"date\" = \"Bolt\\Entity\\Field\\DateField\",\n@@ -24,6 +24,7 @@ use Doctrine\\ORM\\Mapping as ORM;\n* \"filelist\" = \"Bolt\\Entity\\Field\\FilelistField\",\n* \"float\" = \"Bolt\\Entity\\Field\\FloatField\",\n* \"geolocation\" = \"Bolt\\Entity\\Field\\GeolocationField\",\n+ * \"hidden\" = \"Bolt\\Entity\\Field\\HiddenField\",\n* \"html\" = \"Bolt\\Entity\\Field\\HtmlField\",\n* \"image\" = \"Bolt\\Entity\\Field\\ImageField\",\n* \"imagelist\" = \"Bolt\\Entity\\Field\\ImagelistField\",\n@@ -33,10 +34,9 @@ use Doctrine\\ORM\\Mapping as ORM;\n* \"select\" = \"Bolt\\Entity\\Field\\SelectField\",\n* \"slug\" = \"Bolt\\Entity\\Field\\SlugField\",\n* \"templateselect\" = \"Bolt\\Entity\\Field\\TemplateselectField\",\n+ * \"text\" = \"Bolt\\Entity\\Field\\TextField\",\n* \"textarea\" = \"Bolt\\Entity\\Field\\TextareaField\",\n- * \"video\" = \"Bolt\\Entity\\Field\\VideoField\",\n- * \"hidden\" = \"Bolt\\Entity\\Field\\HiddenField\",\n- * \"generic\" = \"field\"\n+ * \"video\" = \"Bolt\\Entity\\Field\\VideoField\"\n* })\n*/\nclass Field\n@@ -143,13 +143,6 @@ class Field\nreturn $this->getDefinition()->type;\n}\n- public function setType(string $type): self\n- {\n- $this->type = $type;\n-\n- return $this;\n- }\n-\npublic function get($key)\n{\nreturn $this->value[$key];\n" } ]
PHP
MIT License
bolt/core
Fix fixtures to create correct fields.
95,144
21.09.2018 16:27:06
-7,200
593c16f30d3762fa2464a0ab21562dab9efad68d
Making excerpts work.
[ { "change_type": "MODIFY", "old_path": "public/theme/skeleton/listing.twig", "new_path": "public/theme/skeleton/listing.twig", "diff": "</a>\n{% endif %}\n- {# display something introduction-like.. #}\n- {% if record.introduction %}\n- {{ record.introduction }}\n- {% elseif record.teaser %}\n- {{ record.teaser }}\n- {% else %}\n<p>{{ record.excerpt(300, false, search|default('')) }}</p>\n- {% endif %}\n{#{% include 'partials/_recordfooter.twig' with { 'record': record } %}#}\n" }, { "change_type": "MODIFY", "old_path": "public/theme/skeleton/record.twig", "new_path": "public/theme/skeleton/record.twig", "diff": "<h1>{{ record.title }}</h1>\n+ {% for field in record.fields %}\n+ {{ dump(field) }}\n+ {{ field }}\n+ {% endfor %}\n+\n<hr>\n+\n{% if record.image %}\n- {{ dump(record.image) }}\n- <p>{{ record.image }}</p>\n- {{ thumbnail(record.image, 400, 260) }}\n-<hr>\n<a href=\"{{ record.image }}\">\n<img src=\"{{ thumbnail(record.image, 400, 260) }}\">\n- <img src=\"{{ record.image|thumbnail(400, 260) }}\">\n</a>\n{% endif %}\n" }, { "change_type": "MODIFY", "old_path": "src/Content/FieldFactory.php", "new_path": "src/Content/FieldFactory.php", "diff": "@@ -14,13 +14,14 @@ final class FieldFactory\n/**\n* @param string $name\n+ *\n* @return Field\n*/\npublic static function get(string $name)\n{\n$classname = '\\\\Bolt\\\\Entity\\\\Field\\\\' . $name . 'Field';\nif (class_exists($classname)) {\n- $field = new $classname;\n+ $field = new $classname();\n} else {\n$field = new Field();\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/FrontendController.php", "new_path": "src/Controller/FrontendController.php", "diff": "@@ -39,10 +39,12 @@ class FrontendController extends AbstractController\n/**\n* @Route(\"/record/{id<[1-9]\\d*>}\", methods={\"GET\"}, name=\"record_by_id\")\n* @Route(\"/record/{slug<[a-z0-9_-]+>}\", methods={\"GET\"}, name=\"record\")\n+ *\n* @param ContentRepository $contentRepository\n* @param FieldRepository $fieldRepository\n* @param null $id\n* @param null $slug\n+ *\n* @return Response\n*/\npublic function record(ContentRepository $contentRepository, FieldRepository $fieldRepository, $id = null, $slug = null): Response\n@@ -69,9 +71,11 @@ class FrontendController extends AbstractController\n* Renders a view.\n*\n* @final\n+ *\n* @param string $view\n* @param array $parameters\n* @param Response|null $response\n+ *\n* @return Response\n*/\nprotected function render(string $view, array $parameters = [], Response $response = null): Response\n" }, { "change_type": "MODIFY", "old_path": "src/DataFixtures/ContentFixtures.php", "new_path": "src/DataFixtures/ContentFixtures.php", "diff": "@@ -7,7 +7,6 @@ namespace Bolt\\DataFixtures;\nuse Bolt\\Configuration\\Config;\nuse Bolt\\Content\\FieldFactory;\nuse Bolt\\Entity\\Content;\n-use Bolt\\Entity\\Field;\nuse Bolt\\Entity\\User;\nuse Cocur\\Slugify\\Slugify;\nuse Doctrine\\Bundle\\FixturesBundle\\Fixture;\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/Content.php", "new_path": "src/Entity/Content.php", "diff": "@@ -4,7 +4,6 @@ declare(strict_types=1);\nnamespace Bolt\\Entity;\n-use Bolt\\Collection\\Bag;\nuse Bolt\\Configuration\\Config;\nuse Bolt\\Content\\ContentType;\nuse Bolt\\Content\\ContentTypeFactory;\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/ContentMagicTraits.php", "new_path": "src/Entity/ContentMagicTraits.php", "diff": "@@ -4,6 +4,8 @@ declare(strict_types=1);\nnamespace Bolt\\Entity;\n+use Bolt\\Helpers\\Excerpt;\n+\ntrait ContentMagicTraits\n{\npublic function __toString(): string\n@@ -49,7 +51,7 @@ trait ContentMagicTraits\n$magicName = 'magic' . $name;\nif (method_exists($this, $magicName)) {\n- return $this->$magicName($arguments);\n+ return $this->$magicName(...$arguments);\n}\n}\n@@ -92,9 +94,12 @@ trait ContentMagicTraits\nreturn 'magic image';\n}\n- public function magicExcerpt()\n+ public function magicExcerpt($length = 200, $includeTitle = false, $focus = null)\n{\n- return 'magic excerpt';\n+ $excerpter = new Excerpt($this);\n+ $excerpt = $excerpter->getExcerpt($length, $includeTitle, $focus);\n+\n+ return new \\Twig_Markup($excerpt, 'utf-8');\n}\npublic function magicPrevious()\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/Field.php", "new_path": "src/Entity/Field.php", "diff": "@@ -92,6 +92,9 @@ class Field\n/** @var FieldType */\nprivate $fieldTypeDefinition;\n+ /** @var bool */\n+ protected $excerptable = false;\n+\npublic function __toString(): string\n{\nreturn implode(', ', $this->getValue());\n@@ -219,4 +222,9 @@ class Field\nreturn $this;\n}\n+\n+ public function isExcerptable(): bool\n+ {\n+ return $this->excerptable;\n+ }\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/Field/HtmlField.php", "new_path": "src/Entity/Field/HtmlField.php", "diff": "@@ -12,4 +12,6 @@ use Doctrine\\ORM\\Mapping as ORM;\n*/\nclass HtmlField extends Field\n{\n+ /** @var bool */\n+ protected $excerptable = true;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/Field/MarkdownField.php", "new_path": "src/Entity/Field/MarkdownField.php", "diff": "@@ -12,4 +12,6 @@ use Doctrine\\ORM\\Mapping as ORM;\n*/\nclass MarkdownField extends Field\n{\n+ /** @var bool */\n+ protected $excerptable = true;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/Field/TextField.php", "new_path": "src/Entity/Field/TextField.php", "diff": "@@ -12,4 +12,6 @@ use Doctrine\\ORM\\Mapping as ORM;\n*/\nclass TextField extends Field\n{\n+ /** @var bool */\n+ protected $excerptable = true;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/Field/TextareaField.php", "new_path": "src/Entity/Field/TextareaField.php", "diff": "@@ -12,4 +12,6 @@ use Doctrine\\ORM\\Mapping as ORM;\n*/\nclass TextareaField extends Field\n{\n+ /** @var bool */\n+ protected $excerptable = true;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/ImageExtension.php", "new_path": "src/Twig/ImageExtension.php", "diff": "@@ -6,9 +6,7 @@ namespace Bolt\\Twig;\nuse Bolt\\Configuration\\Config;\nuse Bolt\\Entity\\Field;\n-use Bolt\\Utils\\Markdown;\nuse League\\Glide\\Urls\\UrlBuilderFactory;\n-use Symfony\\Component\\Intl\\Intl;\nuse Twig\\Extension\\AbstractExtension;\nuse Twig\\TwigFilter;\nuse Twig\\TwigFunction;\n@@ -71,5 +69,4 @@ class ImageExtension extends AbstractExtension\n{\nreturn $input;\n}\n-\n}\n" } ]
PHP
MIT License
bolt/core
Making excerpts work.
95,144
22.09.2018 13:45:27
-7,200
ff1f85c9e0eed9cf0ad219b7db26da143c9aaec3
Make slug slug when set to a slug
[ { "change_type": "MODIFY", "old_path": "composer.json", "new_path": "composer.json", "diff": "\"league/glide-symfony\": \"^1.0\",\n\"sensio/framework-extra-bundle\": \"^5.1\",\n\"sensiolabs/security-checker\": \"^4.1\",\n+ \"stof/doctrine-extensions-bundle\": \"^1.3\",\n\"symfony/asset\": \"^4.1\",\n\"symfony/console\": \"^4.1\",\n\"symfony/debug-pack\": \"^1.0\",\n" }, { "change_type": "MODIFY", "old_path": "composer.lock", "new_path": "composer.lock", "diff": "\"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies\",\n\"This file is @generated automatically\"\n],\n- \"content-hash\": \"6f2dbec8c73ded7034727d7a22bc5c12\",\n+ \"content-hash\": \"e3df1700e49d71249b64e63364bbeb39\",\n\"packages\": [\n+ {\n+ \"name\": \"behat/transliterator\",\n+ \"version\": \"v1.2.0\",\n+ \"source\": {\n+ \"type\": \"git\",\n+ \"url\": \"https://github.com/Behat/Transliterator.git\",\n+ \"reference\": \"826ce7e9c2a6664c0d1f381cbb38b1fb80a7ee2c\"\n+ },\n+ \"dist\": {\n+ \"type\": \"zip\",\n+ \"url\": \"https://api.github.com/repos/Behat/Transliterator/zipball/826ce7e9c2a6664c0d1f381cbb38b1fb80a7ee2c\",\n+ \"reference\": \"826ce7e9c2a6664c0d1f381cbb38b1fb80a7ee2c\",\n+ \"shasum\": \"\"\n+ },\n+ \"require\": {\n+ \"php\": \">=5.3.3\"\n+ },\n+ \"require-dev\": {\n+ \"chuyskywalker/rolling-curl\": \"^3.1\",\n+ \"php-yaoi/php-yaoi\": \"^1.0\"\n+ },\n+ \"type\": \"library\",\n+ \"extra\": {\n+ \"branch-alias\": {\n+ \"dev-master\": \"1.2-dev\"\n+ }\n+ },\n+ \"autoload\": {\n+ \"psr-0\": {\n+ \"Behat\\\\Transliterator\": \"src/\"\n+ }\n+ },\n+ \"notification-url\": \"https://packagist.org/downloads/\",\n+ \"license\": [\n+ \"Artistic-1.0\"\n+ ],\n+ \"description\": \"String transliterator\",\n+ \"keywords\": [\n+ \"i18n\",\n+ \"slug\",\n+ \"transliterator\"\n+ ],\n+ \"time\": \"2017-04-04T11:38:05+00:00\"\n+ },\n{\n\"name\": \"bolt/collection\",\n\"version\": \"v1.1.2\",\n],\n\"time\": \"2018-07-12T10:23:15+00:00\"\n},\n+ {\n+ \"name\": \"gedmo/doctrine-extensions\",\n+ \"version\": \"v2.4.36\",\n+ \"source\": {\n+ \"type\": \"git\",\n+ \"url\": \"https://github.com/Atlantic18/DoctrineExtensions.git\",\n+ \"reference\": \"87c78ff9fd4b90460386f753d95622f6fbbfcb27\"\n+ },\n+ \"dist\": {\n+ \"type\": \"zip\",\n+ \"url\": \"https://api.github.com/repos/Atlantic18/DoctrineExtensions/zipball/87c78ff9fd4b90460386f753d95622f6fbbfcb27\",\n+ \"reference\": \"87c78ff9fd4b90460386f753d95622f6fbbfcb27\",\n+ \"shasum\": \"\"\n+ },\n+ \"require\": {\n+ \"behat/transliterator\": \"~1.2\",\n+ \"doctrine/common\": \"~2.4\",\n+ \"php\": \">=5.3.2\"\n+ },\n+ \"conflict\": {\n+ \"doctrine/annotations\": \"<1.2\"\n+ },\n+ \"require-dev\": {\n+ \"doctrine/common\": \">=2.5.0\",\n+ \"doctrine/mongodb-odm\": \">=1.0.2\",\n+ \"doctrine/orm\": \">=2.5.0\",\n+ \"phpunit/phpunit\": \"^4.8.35|^5.7|^6.5\",\n+ \"symfony/yaml\": \"~2.6|~3.0|~4.0\"\n+ },\n+ \"suggest\": {\n+ \"doctrine/mongodb-odm\": \"to use the extensions with the MongoDB ODM\",\n+ \"doctrine/orm\": \"to use the extensions with the ORM\"\n+ },\n+ \"type\": \"library\",\n+ \"extra\": {\n+ \"branch-alias\": {\n+ \"dev-master\": \"2.4.x-dev\"\n+ }\n+ },\n+ \"autoload\": {\n+ \"psr-4\": {\n+ \"Gedmo\\\\\": \"lib/Gedmo\"\n+ }\n+ },\n+ \"notification-url\": \"https://packagist.org/downloads/\",\n+ \"license\": [\n+ \"MIT\"\n+ ],\n+ \"authors\": [\n+ {\n+ \"name\": \"David Buchmann\",\n+ \"email\": \"david@liip.ch\"\n+ },\n+ {\n+ \"name\": \"Gediminas Morkevicius\",\n+ \"email\": \"gediminas.morkevicius@gmail.com\"\n+ },\n+ {\n+ \"name\": \"Gustavo Falco\",\n+ \"email\": \"comfortablynumb84@gmail.com\"\n+ }\n+ ],\n+ \"description\": \"Doctrine2 behavioral extensions\",\n+ \"homepage\": \"http://gediminasm.org/\",\n+ \"keywords\": [\n+ \"Blameable\",\n+ \"behaviors\",\n+ \"doctrine2\",\n+ \"extensions\",\n+ \"gedmo\",\n+ \"loggable\",\n+ \"nestedset\",\n+ \"sluggable\",\n+ \"sortable\",\n+ \"timestampable\",\n+ \"translatable\",\n+ \"tree\",\n+ \"uploadable\"\n+ ],\n+ \"time\": \"2018-07-26T12:16:35+00:00\"\n+ },\n{\n\"name\": \"guzzlehttp/guzzle\",\n\"version\": \"6.3.3\",\n\"description\": \"A security checker for your composer.lock\",\n\"time\": \"2018-02-28T22:10:01+00:00\"\n},\n+ {\n+ \"name\": \"stof/doctrine-extensions-bundle\",\n+ \"version\": \"v1.3.0\",\n+ \"source\": {\n+ \"type\": \"git\",\n+ \"url\": \"https://github.com/stof/StofDoctrineExtensionsBundle.git\",\n+ \"reference\": \"46db71ec7ffee9122eca3cdddd4ef8d84bae269c\"\n+ },\n+ \"dist\": {\n+ \"type\": \"zip\",\n+ \"url\": \"https://api.github.com/repos/stof/StofDoctrineExtensionsBundle/zipball/46db71ec7ffee9122eca3cdddd4ef8d84bae269c\",\n+ \"reference\": \"46db71ec7ffee9122eca3cdddd4ef8d84bae269c\",\n+ \"shasum\": \"\"\n+ },\n+ \"require\": {\n+ \"gedmo/doctrine-extensions\": \"^2.3.4\",\n+ \"php\": \">=5.3.2\",\n+ \"symfony/framework-bundle\": \"~2.7|~3.2|~4.0\"\n+ },\n+ \"require-dev\": {\n+ \"symfony/phpunit-bridge\": \"^4.0\",\n+ \"symfony/security-bundle\": \"^2.7 || ^3.2 || ^4.0\"\n+ },\n+ \"suggest\": {\n+ \"doctrine/doctrine-bundle\": \"to use the ORM extensions\",\n+ \"doctrine/mongodb-odm-bundle\": \"to use the MongoDB ODM extensions\"\n+ },\n+ \"type\": \"symfony-bundle\",\n+ \"extra\": {\n+ \"branch-alias\": {\n+ \"dev-master\": \"1.3.x-dev\"\n+ }\n+ },\n+ \"autoload\": {\n+ \"psr-4\": {\n+ \"Stof\\\\DoctrineExtensionsBundle\\\\\": \"\"\n+ }\n+ },\n+ \"notification-url\": \"https://packagist.org/downloads/\",\n+ \"license\": [\n+ \"MIT\"\n+ ],\n+ \"authors\": [\n+ {\n+ \"name\": \"Christophe Coevoet\",\n+ \"email\": \"stof@notk.org\"\n+ }\n+ ],\n+ \"description\": \"Integration of the gedmo/doctrine-extensions with Symfony2\",\n+ \"homepage\": \"https://github.com/stof/StofDoctrineExtensionsBundle\",\n+ \"keywords\": [\n+ \"behaviors\",\n+ \"doctrine2\",\n+ \"extensions\",\n+ \"gedmo\",\n+ \"loggable\",\n+ \"nestedset\",\n+ \"sluggable\",\n+ \"sortable\",\n+ \"timestampable\",\n+ \"translatable\",\n+ \"tree\"\n+ ],\n+ \"time\": \"2017-12-24T16:06:50+00:00\"\n+ },\n{\n\"name\": \"swiftmailer/swiftmailer\",\n\"version\": \"v6.1.3\",\n" }, { "change_type": "MODIFY", "old_path": "config/bundles.php", "new_path": "config/bundles.php", "diff": "@@ -18,4 +18,5 @@ return [\nDoctrine\\Bundle\\FixturesBundle\\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],\nSymfony\\Bundle\\MakerBundle\\MakerBundle::class => ['dev' => true],\nEasyCorp\\Bundle\\EasyAdminBundle\\EasyAdminBundle::class => ['all' => true],\n+ Stof\\DoctrineExtensionsBundle\\StofDoctrineExtensionsBundle::class => ['all' => true],\n];\n" }, { "change_type": "ADD", "old_path": null, "new_path": "config/packages/stof_doctrine_extensions.yaml", "diff": "+# Read the documentation: https://symfony.com/doc/current/bundles/StofDoctrineExtensionsBundle/index.html\n+# See the official DoctrineExtensions documentation for more details: https://github.com/Atlantic18/DoctrineExtensions/tree/master/doc/\n+stof_doctrine_extensions:\n+ default_locale: en_US\n" }, { "change_type": "MODIFY", "old_path": "src/DataFixtures/ContentFixtures.php", "new_path": "src/DataFixtures/ContentFixtures.php", "diff": "@@ -8,7 +8,6 @@ use Bolt\\Configuration\\Config;\nuse Bolt\\Content\\FieldFactory;\nuse Bolt\\Entity\\Content;\nuse Bolt\\Entity\\User;\n-use Cocur\\Slugify\\Slugify;\nuse Doctrine\\Bundle\\FixturesBundle\\Fixture;\nuse Doctrine\\Common\\Persistence\\ObjectManager;\nuse Faker\\Factory;\n@@ -25,6 +24,8 @@ class ContentFixtures extends Fixture\n/** @var Config */\nprivate $config;\n+ private $lastTitle = null;\n+\npublic function __construct(UserPasswordEncoderInterface $passwordEncoder, Config $config)\n{\n$this->passwordEncoder = $passwordEncoder;\n@@ -88,7 +89,7 @@ class ContentFixtures extends Fixture\nforeach ($contentType->fields as $name => $fieldType) {\n$field = FieldFactory::get($fieldType['type']);\n$field->setName($name);\n- $field->setValue($this->getValuesforFieldType($fieldType));\n+ $field->setValue($this->getValuesforFieldType($name, $fieldType));\n$field->setSortorder($sortorder++ * 5);\n$content->addField($field);\n@@ -106,7 +107,7 @@ class ContentFixtures extends Fixture\nreturn $statuses[array_rand($statuses)];\n}\n- private function getValuesforFieldType($field)\n+ private function getValuesforFieldType($name, $field)\n{\nswitch ($field['type']) {\ncase 'html':\n@@ -118,7 +119,7 @@ class ContentFixtures extends Fixture\n$data = ['filename' => 'kitten.jpg', 'alt' => 'A cute kitten'];\nbreak;\ncase 'slug':\n- $data = [Slugify::create()->slugify($this->faker->sentence(3, true))];\n+ $data = $this->lastTitle ?? $this->faker->sentence(3, true);\nbreak;\ncase 'text':\n$data = [$this->faker->sentence(6, true)];\n@@ -127,6 +128,10 @@ class ContentFixtures extends Fixture\n$data = [$this->faker->sentence(6, true)];\n}\n+ if ($name === 'title') {\n+ $this->lastTitle = $data;\n+ }\n+\nreturn $data;\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/Field.php", "new_path": "src/Entity/Field.php", "diff": "@@ -61,7 +61,7 @@ class Field\n/**\n* @ORM\\Column(type=\"json\")\n*/\n- private $value = [];\n+ protected $value = [];\n/**\n* @ORM\\Column(type=\"integer\", nullable=true)\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/Field/SlugField.php", "new_path": "src/Entity/Field/SlugField.php", "diff": "@@ -5,6 +5,7 @@ declare(strict_types=1);\nnamespace Bolt\\Entity\\Field;\nuse Bolt\\Entity\\Field;\n+use Cocur\\Slugify\\Slugify;\nuse Doctrine\\ORM\\Mapping as ORM;\n/**\n@@ -12,4 +13,11 @@ use Doctrine\\ORM\\Mapping as ORM;\n*/\nclass SlugField extends Field\n{\n+ public function setValue(array $value): parent\n+ {\n+ $value = Slugify::create()->slugify(reset($value));\n+ $this->value = [$value];\n+\n+ return $this;\n+ }\n}\n" }, { "change_type": "MODIFY", "old_path": "symfony.lock", "new_path": "symfony.lock", "diff": "{\n+ \"behat/transliterator\": {\n+ \"version\": \"v1.2.0\"\n+ },\n\"bolt/collection\": {\n\"version\": \"v1.1.2\"\n},\n\"gecko-packages/gecko-php-unit\": {\n\"version\": \"v2.2\"\n},\n+ \"gedmo/doctrine-extensions\": {\n+ \"version\": \"v2.4.36\"\n+ },\n\"guzzlehttp/guzzle\": {\n\"version\": \"6.3.3\"\n},\n\"ref\": \"576d653444dade07f272c889d52fe4594caa4fc3\"\n}\n},\n+ \"stof/doctrine-extensions-bundle\": {\n+ \"version\": \"1.2\",\n+ \"recipe\": {\n+ \"repo\": \"github.com/symfony/recipes-contrib\",\n+ \"branch\": \"master\",\n+ \"version\": \"1.2\",\n+ \"ref\": \"6c1ceb662f8997085f739cd089bfbef67f245983\"\n+ }\n+ },\n\"swiftmailer/swiftmailer\": {\n\"version\": \"v6.0.2\"\n},\n" } ]
PHP
MIT License
bolt/core
Make slug slug when set to a slug
95,144
25.09.2018 14:25:51
-7,200
88bc06989e4818f307e84e11224f7c0fdb5b8b5b
Adding Menubuilder
[ { "change_type": "ADD", "old_path": null, "new_path": "src/Content/MenuBuilder.php", "diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\Content;\n+\n+use Bolt\\Configuration\\Config;\n+\n+class MenuBuilder\n+{\n+ private $config;\n+\n+ /**\n+ * MenuBuilder constructor.\n+ *\n+ * @param Config $config\n+ */\n+ public function __construct(Config $config)\n+ {\n+ $this->config = $config;\n+ }\n+\n+ public function get()\n+ {\n+ $menu = [\n+ [\n+ 'name' => 'Dashboard',\n+ 'icon' => 'fa-tachometer-alt',\n+ 'link' => '/bolt/',\n+ ],\n+ ];\n+\n+ foreach ($this->config->get('contenttypes') as $contenttype) {\n+ $menu[] = [\n+ 'name' => $contenttype['name'],\n+ 'icon' => 'fa-leaf',\n+ 'link' => '/bolt/content/' . $contenttype['slug'],\n+ 'contenttype' => $contenttype['slug'],\n+ ];\n+ }\n+\n+ $menu[] = [\n+ 'name' => 'Settings',\n+ 'icon' => 'fa-flag',\n+ 'link' => '/bolt/settings',\n+ ];\n+ $menu[] = [\n+ 'name' => 'Users',\n+ 'icon' => 'fa-users',\n+ 'link' => '/bolt/users',\n+ ];\n+\n+ return $menu;\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/Bolt/ContentListingController.php", "new_path": "src/Controller/Bolt/ContentListingController.php", "diff": "@@ -43,6 +43,5 @@ class ContentListingController extends AbstractController\n$records = $content->findAll($page);\nreturn $this->render('bolt/content/listing.twig', ['records' => $records]);\n-\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/ContentMagicTraits.php", "new_path": "src/Entity/ContentMagicTraits.php", "diff": "@@ -124,7 +124,7 @@ trait ContentMagicTraits\n$title[] = $this->get($field);\n}\n- return implode(\" \", $title);\n+ return implode(' ', $title);\n}\npublic function magicImage()\n" }, { "change_type": "MODIFY", "old_path": "src/Helpers/Excerpt.php", "new_path": "src/Helpers/Excerpt.php", "diff": "@@ -46,11 +46,10 @@ class Excerpt\n}\nif ($this->content instanceof Content) {\n-\n$skip_fields = $includeTitle ? $this->content->magicTitleFields() : [];\nforeach ($this->content->getFields() as $key => $field) {\n- if (!in_array($field->getName(), $skip_fields) && $field->isExcerptable()) {\n+ if (!in_array($field->getName(), $skip_fields, true) && $field->isExcerptable()) {\n$excerpt .= (string) $field;\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/AppExtension.php", "new_path": "src/Twig/AppExtension.php", "diff": "@@ -4,6 +4,7 @@ declare(strict_types=1);\nnamespace Bolt\\Twig;\n+use Bolt\\Content\\MenuBuilder;\nuse Bolt\\Utils\\Markdown;\nuse Symfony\\Component\\Intl\\Intl;\nuse Twig\\Extension\\AbstractExtension;\n@@ -25,11 +26,13 @@ class AppExtension extends AbstractExtension\nprivate $parser;\nprivate $localeCodes;\nprivate $locales;\n+ private $menuBuilder;\n- public function __construct(Markdown $parser, string $locales)\n+ public function __construct(Markdown $parser, string $locales, MenuBuilder $menuBuilder)\n{\n$this->parser = $parser;\n$this->localeCodes = explode('|', $locales);\n+ $this->menuBuilder = $menuBuilder;\n}\n/**\n@@ -59,6 +62,7 @@ class AppExtension extends AbstractExtension\nnew TwigFunction('widgets', [$this, 'dummy'], ['is_safe' => ['html']]),\nnew TwigFunction('htmllang', [$this, 'dummy'], ['is_safe' => ['html']]),\nnew TwigFunction('popup', [$this, 'dummy'], ['is_safe' => ['html']]),\n+ new TwigFunction('sidebarmenu', [$this, 'sidebarmenu']),\n];\n}\n@@ -93,4 +97,13 @@ class AppExtension extends AbstractExtension\nreturn $this->locales;\n}\n+\n+ public function sidebarmenu()\n+ {\n+ $menu = $this->menuBuilder->get();\n+\n+ dump($menu);\n+\n+ return $menu;\n+ }\n}\n" }, { "change_type": "MODIFY", "old_path": "templates/bolt/base.html.twig", "new_path": "templates/bolt/base.html.twig", "diff": "{{ include('default/_flash_messages.html.twig') }}\n+ <div class=\"ui form\">\n+ <textarea>{{ sidebarmenu()|json_encode() }}</textarea>\n+ </div>\n{% block body %}\n{% endblock %}\n" } ]
PHP
MIT License
bolt/core
Adding Menubuilder
95,168
25.09.2018 13:35:08
-7,200
c238ffb3df25b9973f58b512a8681161c7d89e6d
Remove Vuex store and things in the way
[ { "change_type": "DELETE", "old_path": "assets/js/Content.vue", "new_path": null, "diff": "-<template>\n- <tr>\n- <td>{{ id }}</td>\n- <td>{{ title.value.value }}</td>\n- </tr>\n-</template>\n-\n-<script>\n- export default {\n- name: 'context',\n- props: [\n- 'id',\n- 'title'\n- ],\n- }\n-</script>\n" }, { "change_type": "MODIFY", "old_path": "assets/js/bolt.js", "new_path": "assets/js/bolt.js", "diff": "import Vue from 'vue';\nimport router from './router';\n-import store from './store';\n// import './registerServiceWorker'\n// Bolt Components\n@@ -11,7 +10,6 @@ import Sidebar from './Sidebar'\nimport Topbar from './Topbar'\nimport DashboardNews from './DashboardNews'\nimport DashboardContentList from './DashboardContentList'\n-import Content from './Content';\nimport App from './App'\nimport '../scss/bolt.scss'\n" }, { "change_type": "DELETE", "old_path": "assets/js/store/content.js", "new_path": null, "diff": "-import ContentAPI from '../service/api/content';\n-\n-export default {\n- namespaced: true,\n- state: {\n- isLoading: false,\n- error: null,\n- content: [],\n- },\n- getters: {\n- isLoading (state) {\n- return state.isLoading;\n- },\n- hasError (state) {\n- return state.error !== null;\n- },\n- error (state) {\n- return state.error;\n- },\n- hasContent (state) {\n- return state.content.length > 0;\n- },\n- content (state) {\n- return state.content;\n- },\n- },\n- mutations: {\n- ['FETCHING_CONTENT'](state) {\n- state.isLoading = true;\n- state.error = null;\n- state.content = [];\n- },\n- ['FETCHING_CONTENT_SUCCESS'](state, content) {\n- state.isLoading = false;\n- state.error = null;\n- state.content = content;\n- },\n- ['FETCHING_CONTENT_ERROR'](state, error) {\n- state.isLoading = false;\n- state.error = error;\n- state.content = [];\n- },\n- },\n- actions: {\n- fetchContent ({commit}, type) {\n- commit('FETCHING_CONTENT');\n- // if exists in localStorage, serve that\n- // state.content['fefef'] -> res.data\n- // ?refresh=1 do real call\n-\n- return ContentAPI.getAll(type)\n- .then(res => commit('FETCHING_CONTENT_SUCCESS', res.data))\n- .catch(err => commit('FETCHING_CONTENT_ERROR', err))\n- ;\n- },\n- },\n-}\n" }, { "change_type": "DELETE", "old_path": "assets/js/store/index.js", "new_path": null, "diff": "-import Vue from 'vue';\n-import Vuex from 'vuex';\n-import ContentModule from './content';\n-\n-Vue.use(Vuex);\n-\n-export default new Vuex.Store({\n- modules: {\n- content: ContentModule,\n- }\n-});\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"vue-loader\": \"^14\",\n\"vue-router\": \"^3.0.1\",\n\"vue-template-compiler\": \"^2.5.17\",\n- \"vuex\": \"^3.0.1\",\n\"workbox-webpack-plugin\": \"^3.6.1\"\n},\n\"dependencies\": {\n" }, { "change_type": "MODIFY", "old_path": "yarn.lock", "new_path": "yarn.lock", "diff": "@@ -5733,10 +5733,6 @@ vue@^2.5.17:\nversion \"2.5.17\"\nresolved \"https://registry.yarnpkg.com/vue/-/vue-2.5.17.tgz#0f8789ad718be68ca1872629832ed533589c6ada\"\n-vuex@^3.0.1:\n- version \"3.0.1\"\n- resolved \"https://registry.yarnpkg.com/vuex/-/vuex-3.0.1.tgz#e761352ebe0af537d4bb755a9b9dc4be3df7efd2\"\n-\nwatchpack@^1.4.0:\nversion \"1.6.0\"\nresolved \"https://registry.yarnpkg.com/watchpack/-/watchpack-1.6.0.tgz#4bc12c2ebe8aa277a71f1d3f14d685c7b446cd00\"\n" } ]
PHP
MIT License
bolt/core
Remove Vuex store and things in the way
95,168
25.09.2018 13:40:19
-7,200
973a34eb7fbd0bef57c531f1ae7ab8c38741a513
Don't pass the store to Vue instances anymore
[ { "change_type": "MODIFY", "old_path": "assets/js/bolt.js", "new_path": "assets/js/bolt.js", "diff": "@@ -25,9 +25,9 @@ Vue.component('dashboardcontentlist', DashboardContentList)\nconst $ = require('jquery');\nglobal.$ = global.jQuery = $;\n-new Vue({ el: 'header', router, store });\n-new Vue({ el: '#sidebar', router, store });\n-new Vue({ el: '#vuecontent', router, store });\n+new Vue({ el: 'header', router });\n+new Vue({ el: '#sidebar', router });\n+new Vue({ el: '#vuecontent', router });\nnew Vue({ el: 'dashboardnews' });\n" } ]
PHP
MIT License
bolt/core
Don't pass the store to Vue instances anymore
95,168
25.09.2018 13:41:42
-7,200
a38978282c9e794dbcb89e247fc281ba25f4af9f
Now we fetch Records from different Contenttypes
[ { "change_type": "MODIFY", "old_path": "assets/js/DashboardContentList.vue", "new_path": "assets/js/DashboardContentList.vue", "diff": "<template>\n<div>\n- <div v-if=\"isLoading\" class=\"row col\">\n+ <div v-if=\"loading\" class=\"row col\">\n<p>Loading...</p>\n</div>\n- <div v-else-if=\"hasError\" class=\"row col\">\n- <div class=\"alert alert-danger\" role=\"alert\">\n- {{ error }}\n- </div>\n- </div>\n-\n- <div v-else-if=\"!hasContent\" class=\"row col\">\n- No content!\n- </div>\n-\n<div v-else>\n<h3>Latest {{ type }}</h3>\n<table>\n<tbody>\n- <template v-for=\"item in content.slice(0, limit)\" class=\"row col\">\n- <tr :key=\"item.id\">\n- <td>{{ item.id }}</td>\n- <td>{{ item.fields[0].value.value }}</td>\n+ <template v-for=\"record in records\" class=\"row col\">\n+ <tr :key=\"record.id\">\n+ <td>{{ record.id }}</td>\n+ <td>{{ record.fields[0].value.value }}</td>\n</tr>\n<!-- Maybe is better to have a component to print each row? -->\n<!-- <Context :id=\"item.id\" :key=\"item.id\" :contenttype=\"content.contenttype\" :title=\"item.fields[0]\"></Context> -->\n<script>\n// import Context from './Content';\n+ import ContentAPI from './service/api/content';\nexport default {\nname: 'context',\ndata () {\nreturn {\nmessage: '',\n+ loading: true,\n+ records: []\n};\n},\ncreated () {\n- this.$store.dispatch('content/fetchContent', this.type);\n- },\n- computed: {\n- isLoading () {\n- // return this.state == 'loading'; // ComponentState.LOADING;\n- return this.$store.getters['content/isLoading'];\n- },\n- hasError () {\n- return this.$store.getters['content/hasError'];\n- },\n- error () {\n- return this.$store.getters['content/error'];\n- },\n- hasContent () {\n- return this.$store.getters['content/hasContent'];\n- },\n- content () {\n- return this.$store.getters['content/content'];\n- },\n+ this.records = ContentAPI.getRecords(this.type)\n+\n+ ContentAPI.fetchRecords(this.type)\n+ .then( records => {\n+ this.records = records\n+ })\n+ .catch(error => console.log(error))\n+ .finally(() => {\n+ this.loading = false\n+ });\n},\n}\n</script>\n" }, { "change_type": "MODIFY", "old_path": "assets/js/service/api/content.js", "new_path": "assets/js/service/api/content.js", "diff": "import axios from 'axios';\nexport default {\n- getAll (type) {\n+ getRecords (type) {\n// where = where || [];\n// implode\n- return axios.get('/api/contents.json?contentType=' + type);\n+ let records = JSON.parse(localStorage.getItem('records-' + type));\n+ return records;\n},\n+\n+ fetchRecords(type) {\n+ return axios.get('/api/contents.json?contentType=' + type + '&pageSize=5')\n+ .then(response => {\n+ // save to localstorage _and_ return data\n+ localStorage.setItem('records', JSON.stringify(response.data));\n+ return response.data\n+ });\n+ }\n}\n\\ No newline at end of file\n" } ]
PHP
MIT License
bolt/core
Now we fetch Records from different Contenttypes
95,168
25.09.2018 15:00:33
-7,200
7e55b601224f5affc11bd6510a0ed453a40fd2e2
Add edit link for Records in Dashboard listing
[ { "change_type": "MODIFY", "old_path": "assets/js/DashboardContentList.vue", "new_path": "assets/js/DashboardContentList.vue", "diff": "<template v-for=\"record in records\" class=\"row col\">\n<tr :key=\"record.id\">\n<td>{{ record.id }}</td>\n- <td>{{ record.fields[0].value.value }}</td>\n+ <td><a :href=\"'edit/'+record.id\">{{ record.fields[0].value.value }}</a></td>\n</tr>\n<!-- Maybe is better to have a component to print each row? -->\n<!-- <Context :id=\"item.id\" :key=\"item.id\" :contenttype=\"content.contenttype\" :title=\"item.fields[0]\"></Context> -->\n" } ]
PHP
MIT License
bolt/core
Add edit link for Records in Dashboard listing
95,168
25.09.2018 16:24:07
-7,200
5f902cf2b148737e502b14f47087b48959ed81f0
Build Sidebar menu with real data
[ { "change_type": "MODIFY", "old_path": "assets/js/Sidebar.vue", "new_path": "assets/js/Sidebar.vue", "diff": "<div class=\"header item logo\">\n<h2>Bolt</h2>\n</div>\n- <a href=\"/bolt/\" class=\"active item\">\n+ <!-- TODO: Maybe we need to parse the data somewhere else -->\n+ <template v-for=\"menuitem in JSON.parse(sidebarmenudata)\">\n+ <a :href=\"menuitem.link\" class=\"item\" v-if=\"!menuitem.contenttype\" :key=\"menuitem.id\">\n<span class=\"fa-stack\">\n<i class=\"fas fa-square fa-stack-2x\"></i>\n- <i class=\"fas fa-tachometer-alt fa-stack-1x\"></i>\n+ <i class=\"fas fa-stack-1x\" :class=\"menuitem.icon\"></i>\n</span>\n- Dashboard\n+ {{ menuitem.name }}\n</a>\n-\n- <div class=\"ui dropdown item\">\n+ <div class=\"ui dropdown item\" :key=\"menuitem.id\" v-else=\"\">\n+ <!-- {{menuitem.contenttype}} -->\n<i class=\"dropdown icon\"></i>\n<span class=\"fa-stack\">\n<i class=\"fas fa-square fa-stack-2x\"></i>\n- <i class=\"fas fa-flag fa-stack-1x\"></i>\n+ <i class=\"fas fa-stack-1x\" :class=\"menuitem.icon\"></i>\n</span>\n- Settings\n+ {{ menuitem.name }}\n<div class=\"menu\">\n+ <!-- TODO: Print Links to latest edited record per contenttype -->\n<div class=\"header\">Text Size</div>\n<a class=\"item\">Small</a>\n<a class=\"item\">Medium</a>\n<a class=\"item\">Large</a>\n</div>\n</div>\n- <a class=\"item\" href=\"/bolt/users\">\n- <span class=\"fa-stack\">\n- <i class=\"fas fa-square fa-stack-2x\"></i>\n- <i class=\"fas fa-users fa-stack-1x\"></i>\n- </span>\n- Users\n- </a>\n+ </template>\n</div>\n</template>\n+<script>\n+ import ContentAPI from './service/api/content';\n+\n+ export default {\n+ name: 'sidebar',\n+ props: [\n+ 'sidebarmenudata',\n+ ],\n+ data () {\n+ return {\n+ message: '',\n+ loading: true,\n+ records: []\n+ };\n+ },\n+ created () {\n+ // TODO: This data is already initialized somewhere else, Use it!!\n+ this.records = ContentAPI.getRecords('pages')\n+\n+ ContentAPI.fetchRecords('pages')\n+ .then( records => {\n+ this.records = records\n+ })\n+ .catch(error => console.log(error))\n+ .finally(() => {\n+ this.loading = false\n+ });\n+ },\n+ }\n+</script>\n+\n<style>\n.ui.small.vertical.menu {\nborder-radius: 0;\nbackground-color: rgba(255, 255, 255, 0.2) !important;\n}\n</style>\n\\ No newline at end of file\n-\n-<script>\n-\n-</script>\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "templates/bolt/base.html.twig", "new_path": "templates/bolt/base.html.twig", "diff": "</header>\n<div id=\"sidebar\">\n- <Sidebar>side</Sidebar>\n+ <Sidebar sidebarmenudata=\"{{ sidebarmenu()|json_encode() }}\">side</Sidebar>\n</div>\n<div id=\"{% block container %}content{% endblock %}\">\n" } ]
PHP
MIT License
bolt/core
Build Sidebar menu with real data
95,144
26.09.2018 17:54:37
-7,200
4fd6c4e22d93557a7c51dca561b9c1721836ce83
Working on listings
[ { "change_type": "MODIFY", "old_path": "src/Content/ContentTypeFactory.php", "new_path": "src/Content/ContentTypeFactory.php", "diff": "@@ -18,10 +18,18 @@ final class ContentTypeFactory\n*\n* @return ContentType\n*/\n- public static function get(string $name, Bag $contenttypesconfig)\n+ public static function get(string $name, Bag $contenttypesconfig): ?ContentType\n{\n- $contentType = ContentType::from($contenttypesconfig[$name]);\n+ if ($contenttypesconfig[$name]) {\n+ return ContentType::from($contenttypesconfig[$name]);\n+ }\n+\n+ foreach ($contenttypesconfig as $item => $value) {\n+ if ($value['singular_slug'] === $name) {\n+ return ContentType::from($contenttypesconfig[$item]);\n+ }\n+ }\n- return $contentType;\n+ return null;\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/Bolt/BackendController.php", "new_path": "src/Controller/Bolt/BackendController.php", "diff": "@@ -5,6 +5,8 @@ declare(strict_types=1);\nnamespace Bolt\\Controller\\Bolt;\nuse Bolt\\Configuration\\Config;\n+use Bolt\\Entity\\Content;\n+use Bolt\\Repository\\ContentRepository;\nuse Bolt\\Version;\nuse Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Security;\nuse Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;\n@@ -22,9 +24,7 @@ class BackendController extends AbstractController\n/** @var Config */\nprivate $config;\n- /** @var Version */\n- private $version;\n-\n+ /** @param Config $config */\npublic function __construct(Config $config)\n{\n$this->config = $config;\n@@ -34,17 +34,19 @@ class BackendController extends AbstractController\n* @Route(\"/\", name=\"bolt_dashboard\")\n* was: (\"/{vueRouting}\", requirements={\"vueRouting\"=\"^(?!api|_(profiler|wdt)).+\"}, name=\"index\")\n*\n- * @param null|string $vueRouting\n+ * @param ContentRepository $content\n*\n* @return Response\n*/\n- public function index(?string $vueRouting = null, $name = 'Gekke Henkie')\n+ public function index(ContentRepository $content)\n{\n$version = Version::VERSION;\n+ /** @var Content $records */\n+ $records = $content->findLatest();\n+\nreturn $this->render('bolt/dashboard/dashboard.twig', [\n- 'vueRouting' => null === $vueRouting ? '/' : '/' . $vueRouting,\n- 'name' => $name,\n+ 'records' => $records,\n'version' => $version,\n]);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/Bolt/ContentListingController.php", "new_path": "src/Controller/Bolt/ContentListingController.php", "diff": "@@ -5,6 +5,7 @@ declare(strict_types=1);\nnamespace Bolt\\Controller\\Bolt;\nuse Bolt\\Configuration\\Config;\n+use Bolt\\Content\\ContentTypeFactory;\nuse Bolt\\Repository\\ContentRepository;\nuse Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Security;\nuse Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;\n@@ -29,19 +30,26 @@ class ContentListingController extends AbstractController\n}\n/**\n- * @Route(\"/content\", name=\"bolt_contentlisting\")\n+ * @Route(\"/content/{contenttype}\", name=\"bolt_contentlisting\")\n*\n- * @param null|string $vueRouting\n+ * @param ContentRepository $content\n+ * @param Request $request\n+ * @param string $contenttype\n*\n* @return Response\n*/\n- public function listing(ContentRepository $content, Request $request): Response\n+ public function listing(ContentRepository $content, Request $request, string $contenttype = ''): Response\n{\n+ $contenttype = ContentTypeFactory::get($contenttype, $this->config->get('contenttypes'));\n+\n$page = (int) $request->query->get('page', 1);\n/** @var Content $records */\n- $records = $content->findAll($page);\n+ $records = $content->findAll($page, $contenttype);\n- return $this->render('bolt/content/listing.twig', ['records' => $records]);\n+ return $this->render('bolt/content/listing.twig', [\n+ 'records' => $records,\n+ 'contenttype' => $contenttype,\n+ ]);\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/Content.php", "new_path": "src/Entity/Content.php", "diff": "@@ -26,7 +26,7 @@ class Content\n{\nuse ContentMagicTraits;\n- public const NUM_ITEMS = 5;\n+ public const NUM_ITEMS = 8;\n/**\n* @ORM\\Id()\n" }, { "change_type": "MODIFY", "old_path": "src/Repository/ContentRepository.php", "new_path": "src/Repository/ContentRepository.php", "diff": "@@ -4,6 +4,7 @@ declare(strict_types=1);\nnamespace Bolt\\Repository;\n+use Bolt\\Content\\ContentType;\nuse Bolt\\Entity\\Content;\nuse Doctrine\\Bundle\\DoctrineBundle\\Repository\\ServiceEntityRepository;\nuse Doctrine\\ORM\\Query;\n@@ -29,16 +30,21 @@ class ContentRepository extends ServiceEntityRepository\nreturn $qb ?: $this->createQueryBuilder('content');\n}\n- public function findAll(int $page = 1): Pagerfanta\n+ public function findAll(int $page = 1, ContentType $contenttype = null): Pagerfanta\n{\n$qb = $this->getQueryBuilder()\n->addSelect('a')\n->innerJoin('content.author', 'a');\n+ if ($contenttype) {\n+ $qb->where('content.contentType = :ct')\n+ ->setParameter('ct', $contenttype['slug']);\n+ }\n+\nreturn $this->createPaginator($qb->getQuery(), $page);\n}\n- public function findLatest(int $page = 1): Pagerfanta\n+ public function findLatest(): ?array\n{\n$qb = $this->getQueryBuilder()\n->addSelect('a')\n@@ -47,7 +53,9 @@ class ContentRepository extends ServiceEntityRepository\n->orderBy('content.publishedAt', 'DESC')\n->setParameter('now', new \\DateTime());\n- return $this->createPaginator($qb->getQuery(), $page);\n+ $result = $qb->getQuery()->getResult();\n+\n+ return array_slice($result, 0, 6);\n}\npublic function findOneBySlug(string $slug)\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/AppExtension.php", "new_path": "src/Twig/AppExtension.php", "diff": "@@ -102,8 +102,6 @@ class AppExtension extends AbstractExtension\n{\n$menu = $this->menuBuilder->get();\n- dump($menu);\n-\nreturn $menu;\n}\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "templates/bolt/_partials/_content_listing.twig", "diff": "+\n+{% if records %}\n+ <table class=\"ui very basic striped table\">\n+ <thead>\n+ <tr>\n+ <th>Title / Excerpt</th>\n+ <th style=\"min-width: 9.5em;\">Meta</th>\n+ <th>Image</th>\n+ <th>Actions</th>\n+ </tr>\n+ </thead>\n+ <tbody>\n+\n+ {% for record in records %}\n+\n+ {% include 'bolt/_partials/_content_record_default.twig' with { 'record': record } %}\n+\n+ {% endfor %}\n+\n+ </tbody>\n+ </table>\n+\n+ {% include 'bolt/_partials/_pager.twig' with { 'records': records } %}\n+\n+{% else %}\n+\n+ (no content)\n+\n+{% endif %}\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "templates/bolt/_partials/_pager.twig", "diff": "+{% if records.haveToPaginate|default() %}\n+ <div class=\"navigation text-center\">\n+ {{ pagerfanta(records, 'semantic_ui_translated', {\n+ routeName: 'bolt_contentlisting',\n+ routeParams: { 'contenttype': contenttype.slug|default() }\n+ }) }}\n+ </div>\n+{% endif %}\n+\n" }, { "change_type": "MODIFY", "old_path": "templates/bolt/base.html.twig", "new_path": "templates/bolt/base.html.twig", "diff": "{{ include('default/_flash_messages.html.twig') }}\n- <div class=\"ui form\">\n- <textarea>{{ sidebarmenu()|json_encode() }}</textarea>\n- </div>\n-\n{% block body %}\n{% endblock %}\n" }, { "change_type": "MODIFY", "old_path": "templates/bolt/dashboard/dashboard.twig", "new_path": "templates/bolt/dashboard/dashboard.twig", "diff": "{% block body %}\n-<button class=\"ui primary button\">\n- Save\n-</button>\n-<button class=\"ui button\">\n- Discard\n-</button>\n-\n-\n-\n-\n-{% set contentTypes = [\n- {\n- slug: 'pages'\n- },\n- {\n- slug: 'homepage'\n- }\n-] %}\n-{% for contentType in contentTypes if true or contentType.showOnDashboard %}\n- <DashboardContentList type=\"{{ contentType.slug }}\" limit=\"5\"></DashboardContentList>\n-{% endfor %}\n+ {% include 'bolt/_partials/_content_listing.twig' with {'records': records } %}\n+\n{% endblock %}\n" } ]
PHP
MIT License
bolt/core
Working on listings
95,168
27.09.2018 09:32:55
-7,200
898a6522fadd06dd57072300e45769d40c8b49e4
Use string type hinting for $view parameter
[ { "change_type": "MODIFY", "old_path": "src/Controller/FrontendController.php", "new_path": "src/Controller/FrontendController.php", "diff": "@@ -112,7 +112,7 @@ class FrontendController extends AbstractController\n*\n* @return Response\n*/\n- protected function render($view, array $parameters = [], Response $response = null): Response\n+ protected function render(string $view, array $parameters = [], Response $response = null): Response\n{\n$themepath = sprintf(\n'%s/%s',\n" } ]
PHP
MIT License
bolt/core
Use string type hinting for $view parameter
95,168
27.09.2018 15:51:24
-7,200
37a54733c1cd3ef5f41743e5ccdb37aca33cda04
Add magic properties to Content Entity
[ { "change_type": "MODIFY", "old_path": "src/Entity/Content.php", "new_path": "src/Entity/Content.php", "diff": "@@ -96,6 +96,16 @@ class Content\n/** @var Config */\nprivate $config;\n+ /**\n+ * Set the \"Magic properties for automagic population in the API\n+ */\n+ public $magictitle;\n+ public $magicexcerpt;\n+ public $magicimage;\n+ public $magiclink;\n+ public $magiceditlink;\n+\n+\npublic function __construct()\n{\n$this->createdAt = new \\DateTime();\n" } ]
PHP
MIT License
bolt/core
Add magic properties to Content Entity
95,144
30.09.2018 18:36:29
-7,200
a846dedd1818ce336db076db1896866a349bcbb3
Adding CSRF for editcontent
[ { "change_type": "MODIFY", "old_path": "src/Controller/Bolt/EditRecordController.php", "new_path": "src/Controller/Bolt/EditRecordController.php", "diff": "@@ -17,6 +17,10 @@ use Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\Routing\\Annotation\\Route;\nuse Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface;\n+use Symfony\\Component\\Security\\Core\\Exception\\InvalidCsrfTokenException;\n+use Symfony\\Component\\Security\\Csrf\\CsrfToken;\n+use Symfony\\Component\\Security\\Csrf\\CsrfTokenManager;\n+use Symfony\\Component\\Security\\Csrf\\CsrfTokenManagerInterface;\n/**\n* Class EditRecordController.\n@@ -32,9 +36,13 @@ class EditRecordController extends AbstractController\n/** @var Version */\nprivate $version;\n- public function __construct(Config $config)\n+ /** @var CsrfTokenManagerInterface */\n+ private $csrfTokenManager;\n+\n+ public function __construct(Config $config, CsrfTokenManagerInterface $csrfTokenManager)\n{\n$this->config = $config;\n+ $this->csrfTokenManager = $csrfTokenManager;\n}\n/**\n@@ -57,6 +65,12 @@ class EditRecordController extends AbstractController\n*/\npublic function edit_post(Content $content = null, Request $request, ObjectManager $manager, UrlGeneratorInterface $urlGenerator): Response\n{\n+ $token = new CsrfToken('editrecord', $request->request->get('_csrf_token'));\n+\n+ if (!$this->csrfTokenManager->isTokenValid($token)) {\n+ throw new InvalidCsrfTokenException();\n+ }\n+\n$content = $this->contentFromPost($content, $request);\n$manager->persist($content);\n" }, { "change_type": "MODIFY", "old_path": "templates/editcontent/edit.twig", "new_path": "templates/editcontent/edit.twig", "diff": "<form method=\"post\" class=\"ui form\" id=\"editcontent\">\n-\n+ <input type=\"hidden\" name=\"_csrf_token\" value=\"{{ csrf_token('editrecord') }}\">\n<!-- fields -->\n{% for field in record.fields %}\n" } ]
PHP
MIT License
bolt/core
Adding CSRF for editcontent
95,144
30.09.2018 18:56:11
-7,200
e7b9769b517ce8775d9ce70ec23835dd3691e7bb
Structuring templates.
[ { "change_type": "RENAME", "old_path": "templates/base.html.twig", "new_path": "templates/_base/layout.twig", "diff": "<div id=\"{% block container %}content{% endblock %}\">\n- {{ include('default/_flash_messages.html.twig') }}\n+ {{ include('_partials/_flash_messages.html.twig') }}\n{% block main %}\n{% endblock %}\n" }, { "change_type": "RENAME", "old_path": "templates/base_blank.twig", "new_path": "templates/_base/layout_blank.twig", "diff": "" }, { "change_type": "RENAME", "old_path": "templates/default/_flash_messages.html.twig", "new_path": "templates/_partials/_flash_messages.html.twig", "diff": "" }, { "change_type": "MODIFY", "old_path": "templates/bundles/TwigBundle/Exception/error.html.twig", "new_path": "templates/bundles/TwigBundle/Exception/error.html.twig", "diff": "See https://symfony.com/doc/current/cookbook/controller/error_pages.html\n#}\n-{% extends 'base.html.twig' %}\n+{% extends '_base/layout.twig' %}\n{% block body_id 'error' %}\n" }, { "change_type": "MODIFY", "old_path": "templates/bundles/TwigBundle/Exception/error403.html.twig", "new_path": "templates/bundles/TwigBundle/Exception/error403.html.twig", "diff": "See https://symfony.com/doc/current/cookbook/controller/error_pages.html\n#}\n-{% extends 'base.html.twig' %}\n+{% extends '_base/layout.twig' %}\n{% block body_id 'error' %}\n" }, { "change_type": "MODIFY", "old_path": "templates/bundles/TwigBundle/Exception/error404.html.twig", "new_path": "templates/bundles/TwigBundle/Exception/error404.html.twig", "diff": "See https://symfony.com/doc/current/cookbook/controller/error_pages.html\n#}\n-{% extends 'base.html.twig' %}\n+{% extends '_base/layout.twig' %}\n{% block body_id 'error' %}\n" }, { "change_type": "MODIFY", "old_path": "templates/bundles/TwigBundle/Exception/error500.html.twig", "new_path": "templates/bundles/TwigBundle/Exception/error500.html.twig", "diff": "See https://symfony.com/doc/current/cookbook/controller/error_pages.html\n#}\n-{% extends 'base.html.twig' %}\n+{% extends '_base/layout.twig' %}\n{% block body_id 'error' %}\n" }, { "change_type": "MODIFY", "old_path": "templates/content/listing.twig", "new_path": "templates/content/listing.twig", "diff": "-{% extends 'base.html.twig' %}\n+{% extends '_base/layout.twig' %}\n{% block title %}\n{% if contenttype %}\n" }, { "change_type": "MODIFY", "old_path": "templates/dashboard/dashboard.twig", "new_path": "templates/dashboard/dashboard.twig", "diff": "-{% extends 'base.html.twig' %}\n+{% extends '_base/layout.twig' %}\n{% block container \"vuecontent\" %}\n" }, { "change_type": "MODIFY", "old_path": "templates/finder/editfile.twig", "new_path": "templates/finder/editfile.twig", "diff": "-{% extends 'base.html.twig' %}\n+{% extends '_base/layout.twig' %}\n{% block container \"widecontent\" %}\n{{ parent() }}\n<script src=\"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.40.2/codemirror.min.js\"></script>\n<script src=\"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.40.2/mode/yaml/yaml.min.js\"></script>\n+<script src=\"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.40.2/mode/html/html.min.js\"></script>\n+<script src=\"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.40.2/mode/htmlmixed/htmlmixed.min.js\"></script>\n+<script src=\"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.40.2/mode/php/php.min.js\"></script>\n<script>\nvar myCodeMirror = CodeMirror.fromTextArea(editfile_textarea,{\nlineNumbers: true,\n" }, { "change_type": "MODIFY", "old_path": "templates/security/login.twig", "new_path": "templates/security/login.twig", "diff": "-{% extends 'base_blank.twig' %}\n+{% extends '_base/layout_blank.twig' %}\n{% block title %}\n{{ 'title.login'|trans }}\n" } ]
PHP
MIT License
bolt/core
Structuring templates.
95,144
30.09.2018 22:03:19
-7,200
ca2bb5221efc0c1c73d43acd1680c51b3a17aa92
Adding Media Entity
[ { "change_type": "MODIFY", "old_path": "composer.json", "new_path": "composer.json", "diff": "\"fzaninotto/faker\": \"^1.8\",\n\"guzzlehttp/guzzle\": \"^6.3\",\n\"league/glide-symfony\": \"^1.0\",\n+ \"miljar/php-exif\": \"^0.6.4\",\n\"nesbot/carbon\": \"^1.34\",\n\"sensio/framework-extra-bundle\": \"^5.1\",\n\"sensiolabs/security-checker\": \"^4.1\",\n" }, { "change_type": "MODIFY", "old_path": "composer.lock", "new_path": "composer.lock", "diff": "\"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies\",\n\"This file is @generated automatically\"\n],\n- \"content-hash\": \"15df5002a0c59d612148f395a577e1ca\",\n+ \"content-hash\": \"d8630df80556926a86f8594fe1710971\",\n\"packages\": [\n{\n\"name\": \"api-platform/api-pack\",\n\"homepage\": \"http://glide.thephpleague.com\",\n\"time\": \"2018-02-10T14:10:07+00:00\"\n},\n+ {\n+ \"name\": \"miljar/php-exif\",\n+ \"version\": \"v0.6.4\",\n+ \"source\": {\n+ \"type\": \"git\",\n+ \"url\": \"https://github.com/PHPExif/php-exif.git\",\n+ \"reference\": \"361c15b8bc7d5ef26a9492fe537f09c920fe6511\"\n+ },\n+ \"dist\": {\n+ \"type\": \"zip\",\n+ \"url\": \"https://api.github.com/repos/PHPExif/php-exif/zipball/361c15b8bc7d5ef26a9492fe537f09c920fe6511\",\n+ \"reference\": \"361c15b8bc7d5ef26a9492fe537f09c920fe6511\",\n+ \"shasum\": \"\"\n+ },\n+ \"require\": {\n+ \"php\": \">=5.3.0\"\n+ },\n+ \"require-dev\": {\n+ \"phpmd/phpmd\": \"~2.2\",\n+ \"phpunit/phpunit\": \"3.7.*\",\n+ \"satooshi/php-coveralls\": \"~0.6\",\n+ \"sebastian/phpcpd\": \"1.4.*@stable\",\n+ \"squizlabs/php_codesniffer\": \"1.4.*@stable\"\n+ },\n+ \"suggest\": {\n+ \"ext-exif\": \"Use exif PHP extension as adapter\",\n+ \"lib-exiftool\": \"Use perl lib exiftool as adapter\"\n+ },\n+ \"type\": \"library\",\n+ \"autoload\": {\n+ \"psr-0\": {\n+ \"PHPExif\": \"lib/\"\n+ }\n+ },\n+ \"notification-url\": \"https://packagist.org/downloads/\",\n+ \"license\": [\n+ \"MIT\"\n+ ],\n+ \"authors\": [\n+ {\n+ \"name\": \"Tom Van Herreweghe\",\n+ \"homepage\": \"http://theanalogguy.be\",\n+ \"role\": \"Developer\"\n+ }\n+ ],\n+ \"description\": \"Object-Oriented EXIF parsing\",\n+ \"keywords\": [\n+ \"IPTC\",\n+ \"exif\",\n+ \"exiftool\",\n+ \"jpeg\",\n+ \"tiff\"\n+ ],\n+ \"time\": \"2018-03-27T10:41:55+00:00\"\n+ },\n{\n\"name\": \"monolog/monolog\",\n\"version\": \"1.23.0\",\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/Bolt/FinderController.php", "new_path": "src/Controller/Bolt/FinderController.php", "diff": "@@ -30,7 +30,7 @@ class FinderController extends AbstractController\n}\n/**\n- * @Route(\"/finder/{area}\", name=\"bolt_finder\", methods={\"GET\"}, defaults={\"path\"=\"\"}, requirements={\"path\"=\".+\"})\n+ * @Route(\"/finder/{area}\", name=\"bolt_finder\", methods={\"GET\"})\n*/\npublic function finder($area, Request $request)\n{\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Controller/Bolt/MediaController.php", "diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\Controller\\Bolt;\n+\n+use Bolt\\Configuration\\Config;\n+use Bolt\\Entity\\Media;\n+use Bolt\\Repository\\MediaRepository;\n+use Carbon\\Carbon;\n+use Doctrine\\Common\\Persistence\\ObjectManager;\n+use PHPExif\\Exif;\n+use PHPExif\\Reader\\Reader;\n+use Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Security;\n+use Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;\n+use Symfony\\Component\\Finder\\Finder;\n+use Symfony\\Component\\HttpFoundation\\Request;\n+use Symfony\\Component\\Routing\\Annotation\\Route;\n+use Webmozart\\PathUtil\\Path;\n+\n+/**\n+ * Class MediaController.\n+ *\n+ * @Route(\"/bolt\")\n+ * @Security(\"has_role('ROLE_ADMIN')\")\n+ */\n+class MediaController extends AbstractController\n+{\n+ /** @var Config */\n+ private $config;\n+\n+ private $mediatypes = ['png', 'jpg', 'jpeg', 'gif', 'svg', 'pdf', 'mp3', 'tiff'];\n+\n+ /** @var MediaRepository */\n+ private $mediaRepository;\n+\n+ /** @var ObjectManager */\n+ private $manager;\n+\n+ /** @var Reader */\n+ private $exif;\n+\n+ public function __construct(Config $config, MediaRepository $mediaRepository, ObjectManager $manager)\n+ {\n+ $this->config = $config;\n+ $this->mediaRepository = $mediaRepository;\n+ $this->manager = $manager;\n+\n+ $this->exif = Reader::factory(Reader::TYPE_NATIVE);\n+ }\n+\n+ /**\n+ * @Route(\"/media/crawl/{area}\", name=\"bolt_media_crawler\", methods={\"GET\"})\n+ */\n+ public function finder($area, Request $request)\n+ {\n+ $areas = [\n+ 'config' => [\n+ 'name' => 'Configuration files',\n+ 'basepath' => $this->config->path('config'),\n+ 'show_all' => true,\n+ ],\n+ 'files' => [\n+ 'name' => 'Content files',\n+ 'basepath' => $this->config->path('files'),\n+ 'show_all' => false,\n+ ],\n+ 'themes' => [\n+ 'name' => 'Theme files',\n+ 'basepath' => $this->config->path('themes'),\n+ 'show_all' => false,\n+ ],\n+ ];\n+\n+ $user = $this->getUser();\n+\n+ $basepath = $areas[$area]['basepath'];\n+\n+ $finder = $this->findFiles($basepath);\n+\n+ foreach ($finder as $file) {\n+ $media = $this->createOrUpdateMedia($file, $area, $user);\n+\n+ $this->manager->persist($media);\n+ $this->manager->flush();\n+ }\n+\n+ dd($file);\n+\n+ return $this->render('finder/finder.twig', [\n+ 'path' => $path,\n+ 'name' => $areas[$area]['name'],\n+ 'area' => $area,\n+ 'finder' => $finder,\n+ 'parent' => $parent,\n+ 'allfiles' => $areas[$area]['show_all'] ? $this->buildIndex($basepath) : false,\n+ ]);\n+ }\n+\n+ private function findFiles($base)\n+ {\n+ $fullpath = Path::canonicalize($base);\n+\n+ $glob = sprintf('*.{%s}', implode(',', $this->mediatypes));\n+\n+ $finder = new Finder();\n+ $finder->in($fullpath)->depth('< 2')->sortByName(true)->name($glob)->files();\n+\n+ return $finder;\n+ }\n+\n+ private function createOrUpdateMedia($file, $area, $user)\n+ {\n+ $media = $this->mediaRepository->findOneBy([\n+ 'area' => $area,\n+ 'path' => $file->getRelativePath(),\n+ 'filename' => $file->getFilename(), ]);\n+\n+ if (!$media) {\n+ $media = new Media();\n+ $media->setFilename($file->getFilename())\n+ ->setPath($file->getRelativePath())\n+ ->setArea($area);\n+ }\n+\n+ $media->setType($file->getExtension())\n+ ->setModifiedAt(Carbon::createFromTimestamp($file->getMTime()))\n+ ->setCreatedAt(Carbon::createFromTimestamp($file->getCTime()))\n+ ->setFilesize($file->getSize())\n+ ->addAuthor($user);\n+\n+ if ($this->isImage($media)) {\n+ $this->updateImageData($media, $file);\n+ }\n+\n+ return $media;\n+ }\n+\n+ private function updateImageData(Media $media, $file)\n+ {\n+ /** @var Exif $exif */\n+ $exif = $this->exif->read($file->getRealPath());\n+\n+ if ($exif) {\n+ $media->setWidth($exif->getWidth())\n+ ->setHeight($exif->getHeight());\n+\n+ return;\n+ }\n+\n+ $imagesize = getimagesize($file->getRealpath());\n+\n+ if ($imagesize) {\n+ $media->setWidth($imagesize[0])\n+ ->setHeight($imagesize[1]);\n+\n+ return;\n+ }\n+ }\n+\n+ private function isImage($media)\n+ {\n+ return in_array($media->getType(), ['gif', 'png', 'jpg', 'svg'], true);\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "src/DataFixtures/ContentFixtures.php", "new_path": "src/DataFixtures/ContentFixtures.php", "diff": "@@ -88,7 +88,7 @@ class ContentFixtures extends Fixture\n$content->setDepublishedAt($this->faker->dateTimeBetween('-1 year'));\n$sortorder = 1;\n- foreach ($contentType->fields as $name => $fieldType) {\n+ foreach ($contentType['fields'] as $name => $fieldType) {\n$field = FieldFactory::get($fieldType['type']);\n$field->setName($name);\n$field->setValue($this->getValuesforFieldType($name, $fieldType));\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Entity/Media.php", "diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\Entity;\n+\n+use Doctrine\\Common\\Collections\\ArrayCollection;\n+use Doctrine\\Common\\Collections\\Collection;\n+use Doctrine\\ORM\\Mapping as ORM;\n+\n+/**\n+ * @ORM\\Entity(repositoryClass=\"Bolt\\Repository\\MediaRepository\")\n+ * @ORM\\Table(name=\"bolt_media\")\n+ */\n+class Media\n+{\n+ /**\n+ * @ORM\\Id()\n+ * @ORM\\GeneratedValue()\n+ * @ORM\\Column(type=\"integer\")\n+ */\n+ private $id;\n+\n+ /**\n+ * @ORM\\Column(type=\"string\", length=191)\n+ */\n+ private $area;\n+\n+ /**\n+ * @ORM\\Column(type=\"string\", length=1000)\n+ */\n+ private $path;\n+\n+ /**\n+ * @ORM\\Column(type=\"string\", length=191)\n+ */\n+ private $filename;\n+\n+ /**\n+ * @ORM\\Column(type=\"string\", length=191)\n+ */\n+ private $type;\n+\n+ /**\n+ * @ORM\\Column(type=\"integer\", nullable=true)\n+ */\n+ private $width;\n+\n+ /**\n+ * @ORM\\Column(type=\"integer\", nullable=true)\n+ */\n+ private $height;\n+\n+ /**\n+ * @ORM\\Column(type=\"integer\")\n+ */\n+ private $filesize;\n+\n+ /**\n+ * @ORM\\ManyToMany(targetEntity=\"Bolt\\Entity\\User\", inversedBy=\"media\")\n+ */\n+ private $author;\n+\n+ /**\n+ * @ORM\\Column(type=\"datetime\")\n+ */\n+ private $createdAt;\n+\n+ /**\n+ * @ORM\\Column(type=\"datetime\")\n+ */\n+ private $modifiedAt;\n+\n+ /**\n+ * @ORM\\Column(type=\"string\", length=191, nullable=true)\n+ */\n+ private $title;\n+\n+ /**\n+ * @ORM\\Column(type=\"string\", length=1000, nullable=true)\n+ */\n+ private $description;\n+\n+ /**\n+ * @ORM\\Column(type=\"string\", length=1000, nullable=true)\n+ */\n+ private $originalFilename;\n+\n+ /**\n+ * @ORM\\Column(type=\"string\", length=191, nullable=true)\n+ */\n+ private $copyright;\n+\n+ public function __construct()\n+ {\n+ $this->author = new ArrayCollection();\n+ }\n+\n+ public function getId(): ?int\n+ {\n+ return $this->id;\n+ }\n+\n+ public function getFilename(): ?string\n+ {\n+ return $this->filename;\n+ }\n+\n+ public function setFilename(string $filename): self\n+ {\n+ $this->filename = $filename;\n+\n+ return $this;\n+ }\n+\n+ public function getArea(): ?string\n+ {\n+ return $this->area;\n+ }\n+\n+ public function setArea(string $area): self\n+ {\n+ $this->area = $area;\n+\n+ return $this;\n+ }\n+\n+ public function getPath(): ?string\n+ {\n+ return $this->path;\n+ }\n+\n+ public function setPath(string $path): self\n+ {\n+ $this->path = $path;\n+\n+ return $this;\n+ }\n+\n+ public function getType(): ?string\n+ {\n+ return $this->type;\n+ }\n+\n+ public function setType(string $type): self\n+ {\n+ if ($type === 'jpeg') {\n+ $type = 'jpg';\n+ }\n+\n+ $this->type = $type;\n+\n+ return $this;\n+ }\n+\n+ public function getWidth(): ?int\n+ {\n+ return $this->width;\n+ }\n+\n+ public function setWidth(?int $width): self\n+ {\n+ $this->width = $width;\n+\n+ return $this;\n+ }\n+\n+ public function getHeight(): ?int\n+ {\n+ return $this->height;\n+ }\n+\n+ public function setHeight(?int $height): self\n+ {\n+ $this->height = $height;\n+\n+ return $this;\n+ }\n+\n+ public function getFilesize(): ?int\n+ {\n+ return $this->filesize;\n+ }\n+\n+ public function setFilesize(int $filesize): self\n+ {\n+ $this->filesize = $filesize;\n+\n+ return $this;\n+ }\n+\n+ public function getCreatedAt(): ?\\DateTimeInterface\n+ {\n+ return $this->createdAt;\n+ }\n+\n+ public function setCreatedAt(\\DateTimeInterface $createdAt): self\n+ {\n+ $this->createdAt = $createdAt;\n+\n+ return $this;\n+ }\n+\n+ public function getModifiedAt(): ?\\DateTimeInterface\n+ {\n+ return $this->modifiedAt;\n+ }\n+\n+ public function setModifiedAt(\\DateTimeInterface $modifiedAt): self\n+ {\n+ $this->modifiedAt = $modifiedAt;\n+\n+ return $this;\n+ }\n+\n+ public function getTitle(): ?string\n+ {\n+ return $this->title;\n+ }\n+\n+ public function setTitle(?string $title): self\n+ {\n+ $this->title = $title;\n+\n+ return $this;\n+ }\n+\n+ public function getDescription(): ?string\n+ {\n+ return $this->description;\n+ }\n+\n+ public function setDescription(?string $description): self\n+ {\n+ $this->description = $description;\n+\n+ return $this;\n+ }\n+\n+ public function getOriginalFilename(): ?string\n+ {\n+ return $this->originalFilename;\n+ }\n+\n+ public function setOriginalFilename(?string $originalFilename): self\n+ {\n+ $this->originalFilename = $originalFilename;\n+\n+ return $this;\n+ }\n+\n+ public function getCopyright(): ?string\n+ {\n+ return $this->copyright;\n+ }\n+\n+ public function setCopyright(?string $copyright): self\n+ {\n+ $this->copyright = $copyright;\n+\n+ return $this;\n+ }\n+\n+ /**\n+ * @return Collection|User[]\n+ */\n+ public function getAuthor(): Collection\n+ {\n+ return $this->author;\n+ }\n+\n+ public function addAuthor(User $author): self\n+ {\n+ if (!$this->author->contains($author)) {\n+ $this->author[] = $author;\n+ }\n+\n+ return $this;\n+ }\n+\n+ public function removeAuthor(User $author): self\n+ {\n+ if ($this->author->contains($author)) {\n+ $this->author->removeElement($author);\n+ }\n+\n+ return $this;\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/User.php", "new_path": "src/Entity/User.php", "diff": "@@ -4,6 +4,8 @@ declare(strict_types=1);\nnamespace Bolt\\Entity;\n+use Doctrine\\Common\\Collections\\ArrayCollection;\n+use Doctrine\\Common\\Collections\\Collection;\nuse Doctrine\\ORM\\Mapping as ORM;\nuse Symfony\\Component\\Security\\Core\\User\\UserInterface;\nuse Symfony\\Component\\Validator\\Constraints as Assert;\n@@ -72,6 +74,16 @@ class User implements UserInterface, \\Serializable\n*/\nprivate $lastIp;\n+ /**\n+ * @ORM\\ManyToMany(targetEntity=\"Bolt\\Entity\\Media\", mappedBy=\"author\")\n+ */\n+ private $media;\n+\n+ public function __construct()\n+ {\n+ $this->media = new ArrayCollection();\n+ }\n+\npublic function getId(): int\n{\nreturn $this->id;\n@@ -203,4 +215,32 @@ class User implements UserInterface, \\Serializable\nreturn $this;\n}\n+\n+ /**\n+ * @return Collection|Media[]\n+ */\n+ public function getMedia(): Collection\n+ {\n+ return $this->media;\n+ }\n+\n+ public function addMedia(Media $media): self\n+ {\n+ if (!$this->media->contains($media)) {\n+ $this->media[] = $media;\n+ $media->addAuthor($this);\n+ }\n+\n+ return $this;\n+ }\n+\n+ public function removeMedia(Media $media): self\n+ {\n+ if ($this->media->contains($media)) {\n+ $this->media->removeElement($media);\n+ $media->removeAuthor($this);\n+ }\n+\n+ return $this;\n+ }\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Repository/MediaRepository.php", "diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\Repository;\n+\n+use Bolt\\Entity\\Media;\n+use Doctrine\\Bundle\\DoctrineBundle\\Repository\\ServiceEntityRepository;\n+use Symfony\\Bridge\\Doctrine\\RegistryInterface;\n+\n+/**\n+ * @method Media|null find($id, $lockMode = null, $lockVersion = null)\n+ * @method Media|null findOneBy(array $criteria, array $orderBy = null)\n+ * @method Media[] findAll()\n+ * @method Media[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)\n+ */\n+class MediaRepository extends ServiceEntityRepository\n+{\n+ public function __construct(RegistryInterface $registry)\n+ {\n+ parent::__construct($registry, Media::class);\n+ }\n+\n+// /**\n+// * @return Media[] Returns an array of Media objects\n+// */\n+ /*\n+ public function findByExampleField($value)\n+ {\n+ return $this->createQueryBuilder('m')\n+ ->andWhere('m.exampleField = :val')\n+ ->setParameter('val', $value)\n+ ->orderBy('m.id', 'ASC')\n+ ->setMaxResults(10)\n+ ->getQuery()\n+ ->getResult()\n+ ;\n+ }\n+ */\n+\n+ /*\n+ public function findOneBySomeField($value): ?Media\n+ {\n+ return $this->createQueryBuilder('m')\n+ ->andWhere('m.exampleField = :val')\n+ ->setParameter('val', $value)\n+ ->getQuery()\n+ ->getOneOrNullResult()\n+ ;\n+ }\n+ */\n+}\n" }, { "change_type": "MODIFY", "old_path": "symfony.lock", "new_path": "symfony.lock", "diff": "\"league/glide-symfony\": {\n\"version\": \"1.0.3\"\n},\n+ \"miljar/php-exif\": {\n+ \"version\": \"v0.6.4\"\n+ },\n\"monolog/monolog\": {\n\"version\": \"1.23.0\"\n},\n" } ]
PHP
MIT License
bolt/core
Adding Media Entity
95,144
02.10.2018 12:06:44
-7,200
ac15feba7c9bdcbba94250bffe315a9bd5aa051d
Make Frontend Controller work on PHP 7 again.
[ { "change_type": "MODIFY", "old_path": "src/Controller/FrontendController.php", "new_path": "src/Controller/FrontendController.php", "diff": "@@ -37,7 +37,7 @@ class FrontendController extends AbstractController\n$template = $this->templateChooser->homepage('');\n- return $this->render($template, []);\n+ return $this->render(current($template), []);\n}\n/**\n@@ -109,8 +109,11 @@ class FrontendController extends AbstractController\n* @param Response|null $response\n*\n* @return Response\n+ * @throws \\Twig_Error_Loader\n+ * @throws \\Twig_Error_Runtime\n+ * @throws \\Twig_Error_Syntax\n*/\n- protected function render($view, array $parameters = [], Response $response = null): Response\n+ protected function render(string $view, array $parameters = [], Response $response = null): Response\n{\n$themepath = sprintf(\n'%s/%s',\n" } ]
PHP
MIT License
bolt/core
Make Frontend Controller work on PHP 7 again.
95,144
02.10.2018 12:45:08
-7,200
97bd8656f8f93231a29f1ca9d7cc58637339ab46
Adding a Slug field twig.
[ { "change_type": "MODIFY", "old_path": "assets/js/bolt.js", "new_path": "assets/js/bolt.js", "diff": "@@ -41,6 +41,9 @@ $(document).ready(function() {\ntransition: 'slide right',\n});\n+ $('.field .ui.dropdown').dropdown({\n+ });\n+\n$('.ui.dropdown.fileselector').dropdown({\ntransition: 'slide down',\nfullTextSearch: 'exact',\n" }, { "change_type": "MODIFY", "old_path": "assets/scss/bolt.scss", "new_path": "assets/scss/bolt.scss", "diff": "@@ -130,7 +130,7 @@ aside {\n}\n.ui.form input[readonly] {\n- background-color: #EEE;\n+ background-color: #F5F5F5;\ncolor: #999;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/FrontendController.php", "new_path": "src/Controller/FrontendController.php", "diff": "@@ -108,10 +108,11 @@ class FrontendController extends AbstractController\n* @param array $parameters\n* @param Response|null $response\n*\n- * @return Response\n* @throws \\Twig_Error_Loader\n* @throws \\Twig_Error_Runtime\n* @throws \\Twig_Error_Syntax\n+ *\n+ * @return Response\n*/\nprotected function render(string $view, array $parameters = [], Response $response = null): Response\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/Field/SlugField.php", "new_path": "src/Entity/Field/SlugField.php", "diff": "@@ -20,4 +20,14 @@ class SlugField extends Field\nreturn $this;\n}\n+\n+ public function getSlugPrefix()\n+ {\n+ return sprintf(\"/%s/\", $this->getContent()->getDefinition()->get('singular_slug'));\n+ }\n+\n+ public function getSlugUseFields()\n+ {\n+ return (array) $this->getDefinition()->get('uses');\n+ }\n}\n" } ]
PHP
MIT License
bolt/core
Adding a Slug field twig.
95,144
02.10.2018 22:07:18
-7,200
0080487931f8a6de9c8eeea05978f13322510c34
Working on Media stuff
[ { "change_type": "MODIFY", "old_path": "src/Content/MenuBuilder.php", "new_path": "src/Content/MenuBuilder.php", "diff": "@@ -33,7 +33,7 @@ class MenuBuilder\n$menu[] = [\n'name' => 'Content',\n'type' => 'separator',\n- 'icon' => 'fa-file'\n+ 'icon' => 'fa-file',\n];\nforeach ($this->config->get('contenttypes') as $contenttype) {\n@@ -42,14 +42,14 @@ class MenuBuilder\n'icon' => 'fa-leaf',\n'link' => '/bolt/content/' . $contenttype['slug'],\n'contenttype' => $contenttype['slug'],\n- 'singleton' => $contenttype['singleton']\n+ 'singleton' => $contenttype['singleton'],\n];\n}\n$menu[] = [\n'name' => 'Settings',\n'type' => 'separator',\n- 'icon' => 'fa-wrench'\n+ 'icon' => 'fa-wrench',\n];\n$menu[] = [\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/Bolt/EditMediaController.php", "new_path": "src/Controller/Bolt/EditMediaController.php", "diff": "@@ -7,11 +7,16 @@ declare(strict_types=1);\nnamespace Bolt\\Controller\\Bolt;\n+use Bolt\\Configuration\\Areas;\nuse Bolt\\Configuration\\Config;\nuse Bolt\\Entity\\Media;\n+use Bolt\\Repository\\MediaRepository;\n+use Carbon\\Carbon;\nuse Doctrine\\Common\\Persistence\\ObjectManager;\n+use PHPExif\\Reader\\Reader;\nuse Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Security;\nuse Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;\n+use Symfony\\Component\\Finder\\SplFileInfo;\nuse Symfony\\Component\\HttpFoundation\\RedirectResponse;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\n@@ -20,6 +25,7 @@ use Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface;\nuse Symfony\\Component\\Security\\Core\\Exception\\InvalidCsrfTokenException;\nuse Symfony\\Component\\Security\\Csrf\\CsrfToken;\nuse Symfony\\Component\\Security\\Csrf\\CsrfTokenManagerInterface;\n+use Webmozart\\PathUtil\\Path;\n/**\n* Class EditMediaController.\n@@ -33,18 +39,64 @@ class EditMediaController extends AbstractController\n*/\nprivate $config;\n- /** @var CsrfTokenManagerInterface\n- */\n+ /** @var CsrfTokenManagerInterface */\nprivate $csrfTokenManager;\n- public function __construct(Config $config, CsrfTokenManagerInterface $csrfTokenManager)\n- {\n+ /** @var ObjectManager */\n+ private $manager;\n+\n+ /** @var UrlGeneratorInterface */\n+ private $urlGenerator;\n+ /**\n+ * @var MediaRepository\n+ */\n+ private $mediaRepository;\n+ /**\n+ * @var Areas\n+ */\n+ private $areas;\n+\n+ /** @var Collection */\n+ private $mediatypes;\n+\n+ /** @var Reader */\n+ private $exif;\n+\n+ /**\n+ * EditMediaController constructor.\n+ *\n+ * @param Config $config\n+ * @param CsrfTokenManagerInterface $csrfTokenManager\n+ * @param ObjectManager $manager\n+ * @param UrlGeneratorInterface $urlGenerator\n+ * @param MediaRepository $mediaRepository\n+ * @param Areas $areas\n+ */\n+ public function __construct(\n+ Config $config,\n+ CsrfTokenManagerInterface $csrfTokenManager,\n+ ObjectManager $manager,\n+ UrlGeneratorInterface $urlGenerator,\n+ MediaRepository $mediaRepository,\n+ Areas $areas\n+ ) {\n$this->config = $config;\n$this->csrfTokenManager = $csrfTokenManager;\n+ $this->manager = $manager;\n+ $this->urlGenerator = $urlGenerator;\n+ $this->mediaRepository = $mediaRepository;\n+ $this->areas = $areas;\n+\n+ $this->exif = Reader::factory(Reader::TYPE_NATIVE);\n+ $this->mediatypes = $config->getMediaTypes();\n}\n/**\n* @Route(\"/media/edit/{id}\", name=\"bolt_media_edit\", methods={\"GET\"})\n+ *\n+ * @param Media|null $media\n+ *\n+ * @return Response\n*/\npublic function edit(Media $media = null)\n{\n@@ -57,8 +109,13 @@ class EditMediaController extends AbstractController\n/**\n* @Route(\"/media/edit/{id}\", name=\"bolt_media_edit_post\", methods={\"POST\"})\n+ *\n+ * @param Media|null $media\n+ * @param Request $request\n+ *\n+ * @return Response\n*/\n- public function editPost(Media $media = null, Request $request, ObjectManager $manager, UrlGeneratorInterface $urlGenerator): Response\n+ public function editPost(Media $media = null, Request $request): Response\n{\n$token = new CsrfToken('media_edit', $request->request->get('_csrf_token'));\n@@ -73,13 +130,105 @@ class EditMediaController extends AbstractController\n->setCopyright($post['copyright'])\n->setOriginalFilename($post['originalFilename']);\n- $manager->persist($media);\n- $manager->flush();\n+ $this->manager->persist($media);\n+ $this->manager->flush();\n$this->addFlash('success', 'content.updated_successfully');\n- $url = $urlGenerator->generate('bolt_media_edit', ['id' => $media->getId()]);\n+ $url = $this->urlGenerator->generate('bolt_media_edit', ['id' => $media->getId()]);\nreturn new RedirectResponse($url);\n}\n+\n+ /**\n+ * @Route(\"/media/new\", name=\"bolt_media_new\", methods={\"GET\"})\n+ *\n+ * @param Request $request\n+ *\n+ * @return RedirectResponse\n+ */\n+ public function new(Request $request): RedirectResponse\n+ {\n+ $area = $request->query->get('area');\n+ $basepath = $this->areas->get($area, 'basepath');\n+ $file = $request->query->get('file');\n+ $filename = $basepath . $file;\n+\n+ $relPath = Path::getDirectory($file);\n+ $relName = Path::getFilename($file);\n+\n+ $file = new SplFileInfo($filename, $relPath, $relName);\n+\n+ $media = $this->createOrUpdateMedia($file, $area);\n+\n+ $this->manager->persist($media);\n+ $this->manager->flush();\n+\n+ $this->addFlash('success', 'content.created_successfully');\n+\n+ $url = $this->urlGenerator->generate('bolt_media_edit', ['id' => $media->getId()]);\n+\n+ return new RedirectResponse($url);\n+ }\n+\n+ /**\n+ * @param string $file\n+ * @param string $area\n+ *\n+ * @return Media\n+ */\n+ private function createOrUpdateMedia(SplFileInfo $file, string $area): Media\n+ {\n+ $media = $this->mediaRepository->findOneBy([\n+ 'area' => $area,\n+ 'path' => $file->getRelativePath(),\n+ 'filename' => $file->getFilename(), ]);\n+\n+ if (!$media) {\n+ $media = new Media();\n+ $media->setFilename($file->getFilename())\n+ ->setPath($file->getRelativePath())\n+ ->setArea($area);\n+ }\n+\n+ $media->setType($file->getExtension())\n+ ->setModifiedAt(Carbon::createFromTimestamp($file->getMTime()))\n+ ->setCreatedAt(Carbon::createFromTimestamp($file->getCTime()))\n+ ->setFilesize($file->getSize())\n+ ->setTitle(ucwords(str_replace('-', ' ', $file->getFilename())))\n+ ->addAuthor($this->getUser());\n+\n+ if ($this->isImage($media)) {\n+ $this->updateImageData($media, $file);\n+ }\n+\n+ return $media;\n+ }\n+\n+ private function updateImageData(Media $media, $file)\n+ {\n+ /** @var Exif $exif */\n+ $exif = $this->exif->read($file->getRealPath());\n+\n+ if ($exif) {\n+ $media->setWidth($exif->getWidth())\n+ ->setHeight($exif->getHeight());\n+\n+ return;\n+ }\n+\n+ $imagesize = getimagesize($file->getRealpath());\n+\n+ if ($imagesize) {\n+ $media->setWidth($imagesize[0])\n+ ->setHeight($imagesize[1]);\n+\n+ return;\n+ }\n+ }\n+\n+ private function isImage($media)\n+ {\n+ return in_array($media->getType(), ['gif', 'png', 'jpg', 'svg'], true);\n+ }\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/Bolt/MediaController.php", "new_path": "src/Controller/Bolt/MediaController.php", "diff": "@@ -16,6 +16,7 @@ use PHPExif\\Reader\\Reader;\nuse Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Security;\nuse Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;\nuse Symfony\\Component\\Finder\\Finder;\n+use Symfony\\Component\\Finder\\SplFileInfo;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\Routing\\Annotation\\Route;\nuse Tightenco\\Collect\\Support\\Collection;\n@@ -75,14 +76,12 @@ class MediaController extends AbstractController\n*/\npublic function finder($area, Request $request)\n{\n- $user = $this->getUser();\n-\n$basepath = $this->areas->get($area, 'basepath');\n$finder = $this->findFiles($basepath);\nforeach ($finder as $file) {\n- $media = $this->createOrUpdateMedia($file, $area, $user);\n+ $media = $this->createOrUpdateMedia($file, $area);\n$this->manager->persist($media);\n$this->manager->flush();\n@@ -112,7 +111,13 @@ class MediaController extends AbstractController\nreturn $finder;\n}\n- private function createOrUpdateMedia($file, $area, $user)\n+ /**\n+ * @param SplFileInfo $file\n+ * @param string $area\n+ *\n+ * @return Media\n+ */\n+ private function createOrUpdateMedia(SplFileInfo $file, string $area): Media\n{\n$media = $this->mediaRepository->findOneBy([\n'area' => $area,\n@@ -131,7 +136,7 @@ class MediaController extends AbstractController\n->setCreatedAt(Carbon::createFromTimestamp($file->getCTime()))\n->setFilesize($file->getSize())\n->setTitle($this->faker->sentence(6, true))\n- ->addAuthor($user);\n+ ->addAuthor($this->getUser());\nif ($this->isImage($media)) {\n$this->updateImageData($media, $file);\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/Field/SlugField.php", "new_path": "src/Entity/Field/SlugField.php", "diff": "@@ -23,7 +23,7 @@ class SlugField extends Field\npublic function getSlugPrefix()\n{\n- return sprintf(\"/%s/\", $this->getContent()->getDefinition()->get('singular_slug'));\n+ return sprintf('/%s/', $this->getContent()->getDefinition()->get('singular_slug'));\n}\npublic function getSlugUseFields()\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/Media.php", "new_path": "src/Entity/Media.php", "diff": "@@ -132,6 +132,10 @@ class Media\npublic function setPath(string $path): self\n{\n+ if (mb_strpos($path, '/') === 0) {\n+ $path = mb_substr($path, 1);\n+ }\n+\n$this->path = $path;\nreturn $this;\n" }, { "change_type": "MODIFY", "old_path": "templates/finder/_files.twig", "new_path": "templates/finder/_files.twig", "diff": "{% if extension in imageformats %}\n{% set thumbnail = filename|thumbnail(100, 72) %}\n{% set icon = 'fa-image' %}\n- {% set link = path('bolt_media_edit', {'id': 0, 'area': area, 'file': filename}) %}\n+ {% set link = path('bolt_media_new', {'area': area, 'file': filename}) %}\n{% for image in media if image.filename in filename %}\n{% set title = image.title %}\n" } ]
PHP
MIT License
bolt/core
Working on Media stuff
95,132
02.10.2018 10:09:09
-7,200
5786a26df9ceec61ef03000b4f40f4595ce627cc
Sort bundles alphabetically
[ { "change_type": "MODIFY", "old_path": "config/bundles.php", "new_path": "config/bundles.php", "diff": "<?php\nreturn [\n- Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle::class => ['all' => true],\n- Symfony\\Bundle\\SecurityBundle\\SecurityBundle::class => ['all' => true],\n- Doctrine\\Bundle\\DoctrineCacheBundle\\DoctrineCacheBundle::class => ['all' => true],\n+ ApiPlatform\\Core\\Bridge\\Symfony\\Bundle\\ApiPlatformBundle::class => ['all' => true],\n+ DAMA\\DoctrineTestBundle\\DAMADoctrineTestBundle::class => ['test' => true],\nDoctrine\\Bundle\\DoctrineBundle\\DoctrineBundle::class => ['all' => true],\n+ Doctrine\\Bundle\\DoctrineCacheBundle\\DoctrineCacheBundle::class => ['all' => true],\n+ Doctrine\\Bundle\\FixturesBundle\\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],\n+ Doctrine\\Bundle\\MigrationsBundle\\DoctrineMigrationsBundle::class => ['all' => true],\n+ Nelmio\\CorsBundle\\NelmioCorsBundle::class => ['all' => true],\nSensio\\Bundle\\FrameworkExtraBundle\\SensioFrameworkExtraBundle::class => ['all' => true],\n+ Stof\\DoctrineExtensionsBundle\\StofDoctrineExtensionsBundle::class => ['all' => true],\n+ Symfony\\Bundle\\DebugBundle\\DebugBundle::class => ['dev' => true, 'test' => true],\n+ Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle::class => ['all' => true],\n+ Symfony\\Bundle\\MakerBundle\\MakerBundle::class => ['dev' => true],\nSymfony\\Bundle\\MonologBundle\\MonologBundle::class => ['all' => true],\n+ Symfony\\Bundle\\SecurityBundle\\SecurityBundle::class => ['all' => true],\nSymfony\\Bundle\\SwiftmailerBundle\\SwiftmailerBundle::class => ['all' => true],\nSymfony\\Bundle\\TwigBundle\\TwigBundle::class => ['all' => true],\n- WhiteOctober\\PagerfantaBundle\\WhiteOctoberPagerfantaBundle::class => ['all' => true],\n- Symfony\\Bundle\\DebugBundle\\DebugBundle::class => ['dev' => true, 'test' => true],\n- Symfony\\Bundle\\WebServerBundle\\WebServerBundle::class => ['dev' => true],\nSymfony\\Bundle\\WebProfilerBundle\\WebProfilerBundle::class => ['dev' => true, 'test' => true],\n- DAMA\\DoctrineTestBundle\\DAMADoctrineTestBundle::class => ['test' => true],\n- Doctrine\\Bundle\\MigrationsBundle\\DoctrineMigrationsBundle::class => ['all' => true],\n- Doctrine\\Bundle\\FixturesBundle\\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],\n- Symfony\\Bundle\\MakerBundle\\MakerBundle::class => ['dev' => true],\n- Nelmio\\CorsBundle\\NelmioCorsBundle::class => ['all' => true],\n- ApiPlatform\\Core\\Bridge\\Symfony\\Bundle\\ApiPlatformBundle::class => ['all' => true],\n- Stof\\DoctrineExtensionsBundle\\StofDoctrineExtensionsBundle::class => ['all' => true],\n+ Symfony\\Bundle\\WebServerBundle\\WebServerBundle::class => ['dev' => true],\n+ WhiteOctober\\PagerfantaBundle\\WhiteOctoberPagerfantaBundle::class => ['all' => true],\n];\n" } ]
PHP
MIT License
bolt/core
Sort bundles alphabetically
95,132
02.10.2018 10:19:06
-7,200
d40d6d96e9b7c4629da484107cbe6e99fbca6c92
Add `theme` alias to themepath in Twig loader
[ { "change_type": "MODIFY", "old_path": "src/Controller/FrontendController.php", "new_path": "src/Controller/FrontendController.php", "diff": "@@ -37,7 +37,7 @@ class FrontendController extends AbstractController\n$template = $this->templateChooser->homepage('');\n- return $this->render(current($template), []);\n+ return $this->render('@theme/index.twig', []);\n}\n/**\n@@ -50,7 +50,7 @@ class FrontendController extends AbstractController\n/** @var Content $records */\n$records = $content->findLatest($page);\n- return $this->render('listing.twig', ['records' => $records]);\n+ return $this->render('@theme/listing.twig', ['records' => $records ]);\n}\n/**\n@@ -81,7 +81,7 @@ class FrontendController extends AbstractController\n$recordSlug => $record,\n];\n- return $this->render('record.twig', $context);\n+ return $this->render('@theme/record.twig', $context);\n}\n/**\n@@ -123,25 +123,4 @@ class FrontendController extends AbstractController\n);\n/** @var \\Twig_Environment $twig */\n- $twig = $this->container->get('twig');\n-\n- $loader = $twig->getLoader();\n- $loader->addPath($themepath);\n- $twig->setLoader($loader);\n-\n- $parameters['config'] = $this->config;\n-\n- // Resolve string|array of templates into the first one that is found.\n- $template = $twig->resolveTemplate($view);\n-\n- $content = $twig->render($template, $parameters);\n-\n- if ($response === null) {\n- $response = new Response();\n- }\n-\n- $response->setContent($content);\n-\n- return $response;\n- }\n-}\n+ $twig = $this->contain\n" } ]
PHP
MIT License
bolt/core
Add `theme` alias to themepath in Twig loader
95,132
02.10.2018 11:57:22
-7,200
8e13aaddbc8d293758420abacee4fa4c62b5d628
Add alternative solution for `addPaths`
[ { "change_type": "MODIFY", "old_path": "config/packages/twig.yaml", "new_path": "config/packages/twig.yaml", "diff": "@@ -4,3 +4,6 @@ twig:\nform_themes:\n- 'form/layout.html.twig'\n- 'form/fields.html.twig'\n+ paths:\n+ '%kernel.project_dir%/public/theme/skeleton': ''\n+ # '%kernel.project_dir%/public/theme/%general.theme%': ''\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/FrontendController.php", "new_path": "src/Controller/FrontendController.php", "diff": "@@ -37,7 +37,7 @@ class FrontendController extends AbstractController\n$template = $this->templateChooser->homepage('');\n- return $this->render('@theme/index.twig', []);\n+ return $this->render('index.twig', []);\n}\n/**\n@@ -50,7 +50,7 @@ class FrontendController extends AbstractController\n/** @var Content $records */\n$records = $content->findLatest($page);\n- return $this->render('@theme/listing.twig', ['records' => $records ]);\n+ return $this->render('listing.twig', ['records' => $records ]);\n}\n/**\n@@ -81,7 +81,7 @@ class FrontendController extends AbstractController\n$recordSlug => $record,\n];\n- return $this->render('@theme/record.twig', $context);\n+ return $this->render('record.twig', $context);\n}\n/**\n@@ -116,11 +116,21 @@ class FrontendController extends AbstractController\n*/\nprotected function render(string $view, array $parameters = [], Response $response = null): Response\n{\n- $themepath = sprintf(\n- '%s/%s',\n- $this->config->getPath('themes'),\n- $this->config->get('general/theme')\n- );\n-\n/** @var \\Twig_Environment $twig */\n- $twig = $this->contain\n+ $twig = $this->container->get('twig');\n+\n+ $parameters['config'] = $this->config;\n+\n+ // Resolve string|array of templates into the first one that is found.\n+ $template = $twig->resolveTemplate($view);\n+\n+ $content = $twig->render($template, $parameters);\n+\n+ if ($response === null) {\n+ $response = new Response();\n+ }\n+\n+ $response->setContent($content);\n+\n+ return $response;\n+ }\n" } ]
PHP
MIT License
bolt/core
Add alternative solution for `addPaths`
95,132
03.10.2018 11:54:24
-7,200
00a4d93161e8a0a6a77f29d69b16852ecd936694
Expose Bolt's config variables
[ { "change_type": "MODIFY", "old_path": "src/Configuration/Config.php", "new_path": "src/Configuration/Config.php", "diff": "@@ -81,6 +81,37 @@ class Config\nreturn $config;\n}\n+ /**\n+ * @return array\n+ */\n+ public function getParameters() : array\n+ {\n+ $array = $this->data->get('general')->toArray();\n+ return $this->flatten($array);\n+ }\n+\n+ /**\n+ * @param array $array\n+ * @param string $prefix\n+ * @return array\n+ */\n+ private function flatten(array $array, string $prefix = '') : array\n+ {\n+ $result = [];\n+ foreach($array as $key => $value) {\n+ if (is_integer($key)) {\n+ $result[trim($prefix, '.')][] = $value;\n+ }\n+ elseif(is_array($value)) {\n+ $result = $result + $this->flatten($value, $prefix . $key . '.');\n+ }\n+ else {\n+ $result[$prefix . $key] = $value;\n+ }\n+ }\n+ return $result;\n+ }\n+\n/**\n* Get a config value, using a path.\n*\n" }, { "change_type": "MODIFY", "old_path": "src/Kernel.php", "new_path": "src/Kernel.php", "diff": "@@ -4,6 +4,7 @@ declare(strict_types=1);\nnamespace Bolt;\n+use Bolt\\Configuration\\Config;\nuse Symfony\\Bundle\\FrameworkBundle\\Kernel\\MicroKernelTrait;\nuse Symfony\\Component\\Config\\Loader\\LoaderInterface;\nuse Symfony\\Component\\Config\\Resource\\FileResource;\n@@ -43,6 +44,12 @@ class Kernel extends BaseKernel\n$container->setParameter('container.dumper.inline_class_loader', true);\n$confDir = $this->getProjectDir() . '/config';\n+ $config = new Config();\n+ foreach ($config->getParameters() as $key => $value) {\n+ $container->setParameter('bolt.' . $key, $value);\n+ }\n+ $container->set('config', $config);\n+\n$loader->load($confDir . '/{packages}/*' . self::CONFIG_EXTS, 'glob');\n$loader->load($confDir . '/{packages}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, 'glob');\n$loader->load($confDir . '/{services}' . self::CONFIG_EXTS, 'glob');\n" } ]
PHP
MIT License
bolt/core
Expose Bolt's config variables
95,132
03.10.2018 13:13:34
-7,200
dcb36bd6071fa36dd3c59586aa344b897fa466a9
Set Twig to use Bolt parameters
[ { "change_type": "MODIFY", "old_path": "config/packages/twig.yaml", "new_path": "config/packages/twig.yaml", "diff": "@@ -5,5 +5,4 @@ twig:\n- 'form/layout.html.twig'\n- 'form/fields.html.twig'\npaths:\n- '%kernel.project_dir%/public/theme/skeleton': ''\n- # '%kernel.project_dir%/public/theme/%general.theme%': ''\n+ '%kernel.project_dir%/public/theme/%bolt.theme%': ''\n" } ]
PHP
MIT License
bolt/core
Set Twig to use Bolt parameters
95,132
03.10.2018 14:25:22
-7,200
62a2b4633ba76e2feb7019882ad20876532daa36
Set correct template for homepage route
[ { "change_type": "MODIFY", "old_path": "src/Controller/FrontendController.php", "new_path": "src/Controller/FrontendController.php", "diff": "@@ -37,7 +37,7 @@ class FrontendController extends AbstractController\n$template = $this->templateChooser->homepage('');\n- return $this->render('index.twig', []);\n+ return $this->render(current($template), []);\n}\n/**\n" } ]
PHP
MIT License
bolt/core
Set correct template for homepage route
95,144
03.10.2018 21:20:46
-7,200
5e264500657077b2f3ce9ac8af0151fc19e90d1f
Working on FrontendController.php
[ { "change_type": "MODIFY", "old_path": "src/Configuration/Config.php", "new_path": "src/Configuration/Config.php", "diff": "@@ -87,28 +87,29 @@ class Config\npublic function getParameters(): array\n{\n$array = $this->data->get('general')->toArray();\n+\nreturn $this->flatten($array);\n}\n/**\n* @param array $array\n* @param string $prefix\n+ *\n* @return array\n*/\nprivate function flatten(array $array, string $prefix = ''): array\n{\n$result = [];\nforeach ($array as $key => $value) {\n- if (is_integer($key)) {\n+ if (is_int($key)) {\n$result[trim($prefix, '.')][] = $value;\n- }\n- elseif(is_array($value)) {\n+ } elseif (is_array($value)) {\n$result = $result + $this->flatten($value, $prefix . $key . '.');\n- }\n- else {\n+ } else {\n$result[$prefix . $key] = $value;\n}\n}\n+\nreturn $result;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/FrontendController.php", "new_path": "src/Controller/FrontendController.php", "diff": "@@ -5,6 +5,7 @@ declare(strict_types=1);\nnamespace Bolt\\Controller;\nuse Bolt\\Configuration\\Config;\n+use Bolt\\Content\\ContentTypeFactory;\nuse Bolt\\Entity\\Content;\nuse Bolt\\Repository\\ContentRepository;\nuse Bolt\\Repository\\FieldRepository;\n@@ -13,6 +14,7 @@ use Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\Routing\\Annotation\\Route;\n+use Tightenco\\Collect\\Support\\Collection;\nclass FrontendController extends AbstractController\n{\n@@ -31,17 +33,28 @@ class FrontendController extends AbstractController\n/**\n* @Route(\"/\", methods={\"GET\"}, name=\"homepage\")\n*/\n- public function homepage()\n+ public function homepage(): Response\n{\n$homepage = $this->getOption('theme/homepage') ?: $this->getOption('general/homepage');\n- $template = $this->templateChooser->homepage('');\n+ // todo get $homepage content.\n- return $this->render(current($template), []);\n+ $templates = $this->templateChooser->homepage();\n+\n+ return $this->renderTemplate($templates, []);\n}\n/**\n* @Route(\"/content\", methods={\"GET\"}, name=\"listing\")\n+ *\n+ * @param ContentRepository $content\n+ * @param Request $request\n+ *\n+ * @throws \\Twig_Error_Loader\n+ * @throws \\Twig_Error_Runtime\n+ * @throws \\Twig_Error_Syntax\n+ *\n+ * @return Response\n*/\npublic function contentListing(ContentRepository $content, Request $request): Response\n{\n@@ -50,7 +63,11 @@ class FrontendController extends AbstractController\n/** @var Content $records */\n$records = $content->findLatest($page);\n- return $this->render('listing.twig', ['records' => $records ]);\n+ $contenttype = ContentTypeFactory::get('pages', $this->config->get('contenttypes'));\n+\n+ $templates = $this->templateChooser->listing($contenttype);\n+\n+ return $this->renderTemplate($templates, ['records' => $records]);\n}\n/**\n@@ -62,6 +79,10 @@ class FrontendController extends AbstractController\n* @param null $id\n* @param null $slug\n*\n+ * @throws \\Twig_Error_Loader\n+ * @throws \\Twig_Error_Runtime\n+ * @throws \\Twig_Error_Syntax\n+ *\n* @return Response\n*/\npublic function record(ContentRepository $contentRepository, FieldRepository $fieldRepository, $id = null, $slug = null): Response\n@@ -71,7 +92,6 @@ class FrontendController extends AbstractController\n} elseif ($slug) {\n$field = $fieldRepository->findOneBySlug($slug);\n$record = $field->getContent();\n-// $record = $contentRepository->findOneBySlug($slug);\n}\n$recordSlug = $record->getDefinition()['singular_slug'];\n@@ -81,7 +101,9 @@ class FrontendController extends AbstractController\n$recordSlug => $record,\n];\n- return $this->render('record.twig', $context);\n+ $templates = $this->templateChooser->record($record);\n+\n+ return $this->renderTemplate($templates, $context);\n}\n/**\n@@ -94,8 +116,6 @@ class FrontendController extends AbstractController\n*/\nprotected function getOption($path, $default = null)\n{\n- dump($this->config->get($path, $default));\n-\nreturn $this->config->get($path, $default);\n}\n@@ -104,7 +124,7 @@ class FrontendController extends AbstractController\n*\n* @final\n*\n- * @param string|array $view\n+ * @param Collection $templates\n* @param array $parameters\n* @param Response|null $response\n*\n@@ -114,7 +134,7 @@ class FrontendController extends AbstractController\n*\n* @return Response\n*/\n- protected function render(string $view, array $parameters = [], Response $response = null): Response\n+ protected function renderTemplate(Collection $templates, array $parameters = [], Response $response = null): Response\n{\n/** @var \\Twig_Environment $twig */\n$twig = $this->container->get('twig');\n@@ -122,7 +142,7 @@ class FrontendController extends AbstractController\n$parameters['config'] = $this->config;\n// Resolve string|array of templates into the first one that is found.\n- $template = $twig->resolveTemplate($view);\n+ $template = $twig->resolveTemplate($templates->toArray());\n$content = $twig->render($template, $parameters);\n" } ]
PHP
MIT License
bolt/core
Working on FrontendController.php
95,144
06.10.2018 14:03:32
-7,200
f1082be8b54b6dccd1a17ba2df915eb992adb43a
Working on fields
[ { "change_type": "MODIFY", "old_path": "src/Content/FieldType.php", "new_path": "src/Content/FieldType.php", "diff": "@@ -8,4 +8,26 @@ use Tightenco\\Collect\\Support\\Collection;\nfinal class FieldType extends Collection\n{\n+ public function __construct($items = [])\n+ {\n+ parent::__construct(array_merge($this->defaults(), $items));\n+ }\n+\n+ private function defaults()\n+ {\n+ $values = [\n+ 'type' => '',\n+ 'class' => '',\n+ 'group' => '',\n+ 'label' => '',\n+ 'variant' => '',\n+ 'postfix' => '',\n+ 'prefix' => '',\n+ 'placeholder' => '',\n+ 'sort' => '',\n+ 'default' => ''\n+ ];\n+\n+ return $values;\n+ }\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Content/FieldTypeFactory.php", "new_path": "src/Content/FieldTypeFactory.php", "diff": "@@ -4,6 +4,8 @@ declare(strict_types=1);\nnamespace Bolt\\Content;\n+use Bolt\\Entity\\Field;\n+\nfinal class FieldTypeFactory\n{\npublic function __construct()\n@@ -14,11 +16,15 @@ final class FieldTypeFactory\n* @param string $name\n* @param ContentType $contentType\n*\n- * @return FieldType\n+ * @return FieldType|null\n*/\n- public static function get(string $name, ContentType $contentType)\n+ public static function get(string $name, ContentType $contentType): ?FieldType\n{\n+ if (isset($contentType['fields'][$name])) {\n$field = new FieldType($contentType['fields'][$name]);\n+ } else {\n+ $field = new FieldType([]);\n+ }\nreturn $field;\n}\n" }, { "change_type": "MODIFY", "old_path": "templates/editcontent/edit.twig", "new_path": "templates/editcontent/edit.twig", "diff": "{% block main %}\n- {{ dump(record) }}\n-\n+ {#{{ dump(record.definition.fields) }}#}\n<form method=\"post\" class=\"ui form\" id=\"editcontent\">\n<input type=\"hidden\" name=\"_csrf_token\" value=\"{{ csrf_token('editrecord') }}\">\n<!-- fields -->\n- {% for field in record.fields %}\n-\n- {% set type = field.definition.type %}\n+ {% for key, fielddefinition in record.definition.fields %}\n+\n+ {% set type = fielddefinition.type %}\n+ {% set field = record.field(key) %}\n+ {% if not field %}\n+ {% set field = {\n+ 'name': key,\n+ 'definition': fielddefinition,\n+ 'value': fielddefinition.default\n+ } %}\n+ {% endif %}\n{% include ['editcontent/fields/' ~ type ~ '.twig', 'editcontent/fields/generic.twig' ] with { 'field': field} %}\n" }, { "change_type": "MODIFY", "old_path": "templates/editcontent/fields/_base.twig", "new_path": "templates/editcontent/fields/_base.twig", "diff": "{% if not label|default() %}\n- {% set label = field.definition.label|default(field.name) %}\n+ {% set label = field.definition.label %}\n{% endif %}\n{% if not name|default() %}\n{% endif %}\n{% if not value|default() %}\n- {% set value = field|default() %}\n+ {% set value = field.value|join|default() %}\n{% endif %}\n{% if not class|default() %}\n" }, { "change_type": "MODIFY", "old_path": "templates/editcontent/fields/html.twig", "new_path": "templates/editcontent/fields/html.twig", "diff": "{% block field %}\n<label>{{ field.definition.label|default(field.name) }}</label>\n<textarea name=\"{{ name }}\" class=\"{{ class }}\">\n-{{ field }}\n+{{ value }}\n</textarea>\n{% endblock %}\n\\ No newline at end of file\n" } ]
PHP
MIT License
bolt/core
Working on fields
95,144
06.10.2018 17:47:21
-7,200
037f5b07abe22766067461a0c592aff85be77c51
Making "new" work properly again.
[ { "change_type": "MODIFY", "old_path": "src/Content/FieldFactory.php", "new_path": "src/Content/FieldFactory.php", "diff": "@@ -19,7 +19,7 @@ final class FieldFactory\n*/\npublic static function get(string $name = 'generic'): Field\n{\n- $classname = '\\\\Bolt\\\\Entity\\\\Field\\\\' . $name . 'Field';\n+ $classname = '\\\\Bolt\\\\Entity\\\\Field\\\\' . ucwords($name) . 'Field';\nif (class_exists($classname)) {\n$field = new $classname();\n} else {\n" }, { "change_type": "MODIFY", "old_path": "src/Content/FieldTypeFactory.php", "new_path": "src/Content/FieldTypeFactory.php", "diff": "@@ -26,4 +26,15 @@ final class FieldTypeFactory\nreturn $field;\n}\n+\n+ public static function mock(array $definition, string $name = null): ?FieldType\n+ {\n+ if ($name) {\n+ $definition['name'] = $name;\n+ }\n+\n+ $field = new FieldType($definition);\n+\n+ return $field;\n+ }\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/Bolt/EditRecordController.php", "new_path": "src/Controller/Bolt/EditRecordController.php", "diff": "@@ -47,11 +47,13 @@ class EditRecordController extends AbstractController\n/**\n* @Route(\"/edit/{id}\", name=\"bolt_edit_record\", methods={\"GET\"})\n*/\n- public function edit(Content $content = null, Request $request): Response\n+ public function edit(string $id = '', Content $content = null, Request $request): Response\n{\nif (!$content) {\n$content = new Content();\n$content->setAuthor($this->getUser());\n+ $content->setContentType($id);\n+ $content->setConfig($this->config);\n}\nreturn $this->render('editcontent/edit.twig', [\n@@ -89,6 +91,8 @@ class EditRecordController extends AbstractController\nif (!$content) {\n$content = new Content();\n$content->setAuthor($this->getUser());\n+ $content->setContentType($request->attributes->get('id'));\n+ $content->setConfig($this->config);\n}\n$content->setStatus($post['status']);\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/ContentMagicTraits.php", "new_path": "src/Entity/ContentMagicTraits.php", "diff": "@@ -111,6 +111,8 @@ trait ContentMagicTraits\n}\n}\n}\n+\n+ return [];\n}\n/**\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/Field.php", "new_path": "src/Entity/Field.php", "diff": "@@ -117,6 +117,11 @@ class Field\nreturn $this->fieldTypeDefinition;\n}\n+ public function setDefinition(array $definition, $name = null)\n+ {\n+ $this->fieldTypeDefinition = FieldTypeFactory::mock($definition, $name);\n+ }\n+\npublic function getContentId(): ?int\n{\nreturn $this->content_id;\n@@ -148,7 +153,7 @@ class Field\npublic function get($key)\n{\n- return $this->value[$key];\n+ return isset($this->value[$key]) ? $this->value[$key] : null;\n}\npublic function getValue(): ?array\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/Field/SlugField.php", "new_path": "src/Entity/Field/SlugField.php", "diff": "@@ -23,7 +23,13 @@ class SlugField extends Field\npublic function getSlugPrefix()\n{\n- return sprintf('/%s/', $this->getContent()->getDefinition()->get('singular_slug'));\n+ $content = $this->getContent();\n+\n+ if (!$content) {\n+ return '/foobar/';\n+ }\n+\n+ return sprintf('/%s/', $content->getDefinition()->get('singular_slug'));\n}\npublic function getSlugUseFields()\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/AppExtension.php", "new_path": "src/Twig/AppExtension.php", "diff": "@@ -4,6 +4,7 @@ declare(strict_types=1);\nnamespace Bolt\\Twig;\n+use Bolt\\Content\\FieldFactory;\nuse Bolt\\Content\\MenuBuilder;\nuse Bolt\\Helpers\\Excerpt;\nuse Bolt\\Utils\\Markdown;\n@@ -38,6 +39,7 @@ class AppExtension extends AbstractExtension\nnew TwigFilter('localedatetime', [$this, 'dummy']),\nnew TwigFilter('showimage', [$this, 'dummy']),\nnew TwigFilter('excerpt', [$this, 'excerpt']),\n+ new TwigFilter('ucwords', [$this, 'ucwords']),\n];\n}\n@@ -55,6 +57,7 @@ class AppExtension extends AbstractExtension\nnew TwigFunction('htmllang', [$this, 'dummy'], ['is_safe' => ['html']]),\nnew TwigFunction('popup', [$this, 'dummy'], ['is_safe' => ['html']]),\nnew TwigFunction('sidebarmenu', [$this, 'sidebarmenu']),\n+ new TwigFunction('fieldfactory', [$this, 'fieldfactory']),\n];\n}\n@@ -63,6 +66,15 @@ class AppExtension extends AbstractExtension\nreturn $input;\n}\n+ public function ucwords($content, string $delimiters = ''): string\n+ {\n+ if (!$content) {\n+ return '';\n+ }\n+\n+ return ucwords($content, $delimiters);\n+ }\n+\n/**\n* Transforms the given Markdown content into HTML content.\n*/\n@@ -103,4 +115,13 @@ class AppExtension extends AbstractExtension\nreturn $excerpter->getExcerpt((int) $length);\n}\n+\n+ public function fieldfactory($definition, $name = null)\n+ {\n+ $field = FieldFactory::get($definition['type']);\n+ $field->setName($name);\n+ $field->setDefinition($definition, $name);\n+\n+ return $field;\n+ }\n}\n" }, { "change_type": "MODIFY", "old_path": "templates/editcontent/edit.twig", "new_path": "templates/editcontent/edit.twig", "diff": "{% set type = fielddefinition.type %}\n{% set field = record.field(key) %}\n{% if not field %}\n- {% set field = {\n- 'name': key,\n- 'definition': fielddefinition,\n- 'value': fielddefinition.default\n- } %}\n+ {% set field = fieldfactory(fielddefinition, key) %}\n{% endif %}\n{% include ['editcontent/fields/' ~ type ~ '.twig', 'editcontent/fields/generic.twig' ] with { 'field': field} %}\n" }, { "change_type": "MODIFY", "old_path": "templates/editcontent/fields/_base.twig", "new_path": "templates/editcontent/fields/_base.twig", "diff": "{% if not label|default() %}\n- {% set label = field.definition.label %}\n+ {% set label = field.definition.label|default(field.name|ucwords) %}\n{% endif %}\n{% if not name|default() %}\n{% endif %}\n{% if not value|default() %}\n+ {% if field.value is defined %}\n{% set value = field.value|join|default() %}\n+ {% else %}\n+ {% set value = '' %}\n+ {% endif %}\n{% endif %}\n{% if not class|default() %}\n" }, { "change_type": "MODIFY", "old_path": "templates/editcontent/fields/html.twig", "new_path": "templates/editcontent/fields/html.twig", "diff": "{% extends '@bolt/editcontent/fields/_base.twig' %}\n{% block field %}\n- <label>{{ field.definition.label|default(field.name) }}</label>\n- <textarea name=\"{{ name }}\" class=\"{{ class }}\">\n-{{ value }}\n- </textarea>\n+ <label>{{ label }}</label>\n+ <textarea name=\"{{ name }}\" class=\"{{ class }}\">{{ value }}</textarea>\n{% endblock %}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "templates/editcontent/fields/image.twig", "new_path": "templates/editcontent/fields/image.twig", "diff": "<div class=\"inline field\">\n<label>Filename</label>\n- <input name=\"{{ name }}[filename]\" placeholder=\"First Name\" type=\"text\" value=\"{{ value.get('filename') }}\" class=\"{{ class }}\" {{ attributes|default()|raw }}>\n+ <input name=\"{{ name }}[filename]\" placeholder=\"First Name\" type=\"text\" value=\"{{ field.get('filename') }}\" class=\"{{ class }}\" {{ attributes|default()|raw }}>\n</div>\n<div class=\"inline field\">\n<label>Alt</label>\n- <input name=\"{{ name }}[alt]\" placeholder=\"First Name\" type=\"text\" value=\"{{ value.get('alt') }}\" class=\"{{ class }}\" {{ attributes|default()|raw }}>\n+ <input name=\"{{ name }}[alt]\" placeholder=\"First Name\" type=\"text\" value=\"{{ field.get('alt') }}\" class=\"{{ class }}\" {{ attributes|default()|raw }}>\n</div>\n<hr>\n{% endblock %}\n" }, { "change_type": "MODIFY", "old_path": "templates/editcontent/fields/markdown.twig", "new_path": "templates/editcontent/fields/markdown.twig", "diff": "{% extends '@bolt/editcontent/fields/_base.twig' %}\n{% block field %}\n- <label>{{ field.definition.label|default(field.name) }}</label>\n- <textarea name=\"{{ name }}\" class=\"{{ class }}\" id=\"edit-{{ name }}\">{{ value }}</textarea>\n+ <label>{{ label }}</label>\n+ <textarea name=\"{{ name }}\" class=\"{{ class }}\" id=\"{{ name }}\">{{ value }}</textarea>\n{% endblock %}\n<script src=\"{{ asset('assets/markdown.js') }}\"></script>\n<script>\nvar simplemde = new SimpleMDE({\n- element: document.getElementById(\"edit-{{ name }}\"),\n+ element: document.getElementById(\"{{ name }}\"),\nspellChecker: false,\nstatus: false\n});\n" } ]
PHP
MIT License
bolt/core
Making "new" work properly again.
95,144
06.10.2018 19:11:56
-7,200
b480425678617be2a9340eb7cd03b6c20ba2de70
Update templates/editcontent/media_edit.twig
[ { "change_type": "MODIFY", "old_path": "templates/editcontent/media_edit.twig", "new_path": "templates/editcontent/media_edit.twig", "diff": "<img id=\"main_image\" src=\"{{ thumbnail }}\">\n</div>\n- <div class=\"field\" style=\"margin: 0.5rem 0;\">\n- <button class=\"ui button tiny color-Vibrant\" style=\"text-shadow: 1px 1px 5px rgba(0, 0, 0, 0.3); color: #FFF;\">\n- Vibrant <small>(<span></span>)</small>\n- </button>\n- &nbsp;\n- <button class=\"ui button tiny color-Muted\" style=\"text-shadow: 1px 1px 5px rgba(255, 255, 255, 0.5);\">\n- Muted <small>(<span></span>)</small>\n- </button>\n- &nbsp;\n- <button class=\"ui button tiny color-DarkVibrant\" style=\"text-shadow: 1px 1px 5px rgba(0, 0, 0, 0.3); color: #FFF;\">\n- DarkVibrant <small>(<span></span>)</small>\n- </button>\n- &nbsp;\n- <button class=\"ui button tiny color-DarkMuted\" style=\"text-shadow: 1px 1px 5px rgba(0, 0, 0, 0.3); color: #FFF;\">\n- DarkMuted <small>(<span></span>)</small>\n- </button>\n- &nbsp;\n- <button class=\"ui button tiny color-LightVibrant\" style=\"text-shadow: 1px 1px 5px rgba(255, 255, 255, 0.5);\">\n- LightVibrant <small>(<span></span>)</small>\n- </button>\n- </div>\n-\n<script>\n- console.log('joe');\nvar img = document.createElement('img');\nimg.setAttribute('src', '{{ thumbnail|raw }}');\nimg.addEventListener('load', function() {\nvar vibrant = new Vibrant(img);\nvar swatches = vibrant.swatches();\n- console.log(swatches);\nfor (var swatch in swatches) {\nif (swatches.hasOwnProperty(swatch) && swatches[swatch]) {\n- console.log(swatch, swatches[swatch].getHex());\n- $('.button.color-' + swatch).css('background', swatches[swatch].getHex());\n- $('.button.color-' + swatch).find('span').text(swatches[swatch].getHex());\n+ var elem = document.createElement('li');\n+ var label = document.createElement('div');\n+ var labelNode = document.createTextNode(swatches[swatch].getHex());\n+ var referenceNode = document.getElementById('swatcheslist');\n+ label.className = \"ui horizontal label\";\n+ label.setAttribute('style', 'background-color: ' + swatches[swatch].getHex());\n+ elem.appendChild(label).appendChild(labelNode);\n+ elem.appendChild(document.createTextNode(swatch));\n+ referenceNode.append(elem);\n}\n}\n});\n- console.log('joe2');\n-\n- /*\n- * Results into:\n- * Vibrant #7a4426\n- * Muted #7b9eae\n- * DarkVibrant #348945\n- * DarkMuted #141414\n- * LightVibrant #f3ccb4\n- */\n-\n</script>\n<input type=\"submit\" class=\"ui button primary\" value=\"Save\" form=\"editcontent\">\n+ <ul class=\"ui divided selection list\" id=\"swatcheslist\">\n+ </ul>\n+\n+\n{% include '@bolt/editcontent/fields/text.twig' with {\n'label': 'field.id'|trans,\n'name': 'id',\n" } ]
PHP
MIT License
bolt/core
Update templates/editcontent/media_edit.twig
95,144
07.10.2018 10:06:02
-7,200
78ed2c092c0f7663e79f4bac2c1e91f2d1ed6a17
Working on select fields
[ { "change_type": "ADD", "old_path": null, "new_path": "assets/js/helpers/ready.js", "diff": "+(function(funcName, baseObj) {\n+ \"use strict\";\n+ // The public function name defaults to window.docReady\n+ // but you can modify the last line of this function to pass in a different object or method name\n+ // if you want to put them in a different namespace and those will be used instead of\n+ // window.docReady(...)\n+ funcName = funcName || \"docReady\";\n+ baseObj = baseObj || window;\n+ var readyList = [];\n+ var readyFired = false;\n+ var readyEventHandlersInstalled = false;\n+\n+ // call this when the document is ready\n+ // this function protects itself against being called more than once\n+ function ready() {\n+ if (!readyFired) {\n+ // this must be set to true before we start calling callbacks\n+ readyFired = true;\n+ for (var i = 0; i < readyList.length; i++) {\n+ // if a callback here happens to add new ready handlers,\n+ // the docReady() function will see that it already fired\n+ // and will schedule the callback to run right after\n+ // this event loop finishes so all handlers will still execute\n+ // in order and no new ones will be added to the readyList\n+ // while we are processing the list\n+ readyList[i].fn.call(window, readyList[i].ctx);\n+ }\n+ // allow any closures held by these functions to free\n+ readyList = [];\n+ }\n+ }\n+\n+ function readyStateChange() {\n+ if ( document.readyState === \"complete\" ) {\n+ ready();\n+ }\n+ }\n+\n+ // This is the one public interface\n+ // docReady(fn, context);\n+ // the context argument is optional - if present, it will be passed\n+ // as an argument to the callback\n+ baseObj[funcName] = function(callback, context) {\n+ if (typeof callback !== \"function\") {\n+ throw new TypeError(\"callback for docReady(fn) must be a function\");\n+ }\n+ // if ready has already fired, then just schedule the callback\n+ // to fire asynchronously, but right away\n+ if (readyFired) {\n+ setTimeout(function() {callback(context);}, 1);\n+ return;\n+ } else {\n+ // add the function and context to the list\n+ readyList.push({fn: callback, ctx: context});\n+ }\n+ // if document already ready to go, schedule the ready function to run\n+ // IE only safe when readyState is \"complete\", others safe when readyState is \"interactive\"\n+ if (document.readyState === \"complete\" || (!document.attachEvent && document.readyState === \"interactive\")) {\n+ setTimeout(ready, 1);\n+ } else if (!readyEventHandlersInstalled) {\n+ // otherwise if we don't have event handlers installed, install them\n+ if (document.addEventListener) {\n+ // first choice is DOMContentLoaded event\n+ document.addEventListener(\"DOMContentLoaded\", ready, false);\n+ // backup is window load event\n+ window.addEventListener(\"load\", ready, false);\n+ } else {\n+ // must be IE\n+ document.attachEvent(\"onreadystatechange\", readyStateChange);\n+ window.attachEvent(\"onload\", ready);\n+ }\n+ readyEventHandlersInstalled = true;\n+ }\n+ }\n+})(\"ready\", window);\n+// modify this previous line to pass in your own method name\n+// and object for the method to be attached to\n" }, { "change_type": "MODIFY", "old_path": "config/bolt/contenttypes.yml", "new_path": "config/bolt/contenttypes.yml", "diff": "@@ -261,18 +261,41 @@ blocks:\nslug:\ntype: slug\nuses: [ title ]\n- content:\n- type: html\n- height: 150px\n- contentlink:\n- type: text\n- label: Link\n- placeholder: 'contenttype/slug or http://example.org/'\n- postfix: \"Use this to add a link for this Block. This could either be an 'internal' link like <tt>page/about</tt>, if you use a contenttype/slug combination. Otherwise use a proper URL, like `http://example.org`.\"\n- image:\n- type: image\n- attrib: title\n- extensions: [ gif, jpg, png ]\n+ selectfield:\n+ type: select\n+ values: [ foo, bar, baz ]\n+ selectfieldd:\n+ type: select\n+ values:\n+ foo: \"Fooo\"\n+ bar: Bario\n+ baz: Bazz\n+ multiselect:\n+ type: select\n+ values: [ A-tuin, Donatello, Rafael, Leonardo, Michelangelo, Koopa, Squirtle ]\n+ multiple: true\n+ postfix: \"Select your favourite turtle(s).\"\n+\n+ multiselect2:\n+ type: select\n+ values: [ A-tuin, Donatello, Rafael, Leonardo, Michelangelo, Koopa, Squirtle ]\n+ multiple: true\n+ required: true\n+ postfix: \"Select your favourite turtle(s).\"\n+\n+\n+# content:\n+# type: html\n+# height: 150px\n+# contentlink:\n+# type: text\n+# label: Link\n+# placeholder: 'contenttype/slug or http://example.org/'\n+# postfix: \"Use this to add a link for this Block. This could either be an 'internal' link like <tt>page/about</tt>, if you use a contenttype/slug combination. Otherwise use a proper URL, like `http://example.org`.\"\n+# image:\n+# type: image\n+# attrib: title\n+# extensions: [ gif, jpg, png ]\nshow_on_dashboard: true\nviewless: true\ndefault_status: published\n" }, { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "\"dependencies\": {\n\"axios\": \"^0.18.0\",\n\"codemirror\": \"^5.40.2\",\n+ \"selectize\": \"^0.12.6\",\n\"semantic-ui-calendar\": \"^0.0.8\",\n\"simplemde\": \"^1.11.2\",\n\"vue\": \"^2.5.17\"\n" }, { "change_type": "MODIFY", "old_path": "public/assets/service-worker.js", "new_path": "public/assets/service-worker.js", "diff": "* See https://goo.gl/2aRDsh\n*/\n-importScripts(\"https://storage.googleapis.com/workbox-cdn/releases/3.6.1/workbox-sw.js\");\n+importScripts(\"https://storage.googleapis.com/workbox-cdn/releases/3.6.2/workbox-sw.js\");\nimportScripts(\n- \"/assets/sw/precache-manifest.1121b18cfb014fc14f839b3df1683294.js\"\n+ \"/assets/sw/precache-manifest.da22dc71fb61b4497247f1e135bd89a6.js\"\n);\nworkbox.clientsClaim();\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/AppExtension.php", "new_path": "src/Twig/AppExtension.php", "diff": "@@ -20,11 +20,10 @@ class AppExtension extends AbstractExtension\nprivate $locales;\nprivate $menuBuilder;\n- public function __construct(Markdown $parser, string $locales, MenuBuilder $menuBuilder)\n+ public function __construct(Markdown $parser, string $locales)\n{\n$this->parser = $parser;\n$this->localeCodes = explode('|', $locales);\n- $this->menuBuilder = $menuBuilder;\n}\n/**\n@@ -56,8 +55,6 @@ class AppExtension extends AbstractExtension\nnew TwigFunction('widgets', [$this, 'dummy'], ['is_safe' => ['html']]),\nnew TwigFunction('htmllang', [$this, 'dummy'], ['is_safe' => ['html']]),\nnew TwigFunction('popup', [$this, 'dummy'], ['is_safe' => ['html']]),\n- new TwigFunction('sidebarmenu', [$this, 'sidebarmenu']),\n- new TwigFunction('fieldfactory', [$this, 'fieldfactory']),\n];\n}\n@@ -102,26 +99,10 @@ class AppExtension extends AbstractExtension\nreturn $this->locales;\n}\n- public function sidebarmenu()\n- {\n- $menu = $this->menuBuilder->get();\n-\n- return $menu;\n- }\n-\npublic function excerpt($text, $length = 100)\n{\n$excerpter = new Excerpt($text);\nreturn $excerpter->getExcerpt((int) $length);\n}\n-\n- public function fieldfactory($definition, $name = null)\n- {\n- $field = FieldFactory::get($definition['type']);\n- $field->setName($name);\n- $field->setDefinition($definition, $name);\n-\n- return $field;\n- }\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Twig/ContentHelperExtension.php", "diff": "+<?php\n+/**\n+ *\n+ *\n+ * @author Bob den Otter <bobdenotter@gmail.com>\n+ */\n+\n+namespace Bolt\\Twig;\n+\n+\n+use Bolt\\Content\\FieldFactory;\n+use Bolt\\Content\\MenuBuilder;\n+use Bolt\\Entity\\Field;\n+use Twig\\Extension\\AbstractExtension;\n+use Twig\\TwigFilter;\n+use Twig\\TwigFunction;\n+\n+class ContentHelperExtension extends AbstractExtension\n+{\n+ /** @var MenuBuilder */\n+ private $menuBuilder;\n+\n+ public function __construct(MenuBuilder $menuBuilder)\n+ {\n+ $this->menuBuilder = $menuBuilder;\n+ }\n+\n+ /**\n+ * {@inheritdoc}\n+ */\n+ public function getFilters(): array\n+ {\n+ return [\n+ ];\n+ }\n+\n+ /**\n+ * {@inheritdoc}\n+ */\n+ public function getFunctions(): array\n+ {\n+ return [\n+ new TwigFunction('sidebarmenu', [$this, 'sidebarmenu']),\n+ new TwigFunction('fieldfactory', [$this, 'fieldfactory']),\n+ new TwigFunction('selectoptionsfromarray', [$this, 'selectoptionsfromarray'])\n+ ];\n+ }\n+\n+\n+ public function sidebarmenu()\n+ {\n+ $menu = $this->menuBuilder->get();\n+\n+ return $menu;\n+ }\n+\n+ public function fieldfactory($definition, $name = null)\n+ {\n+ $field = FieldFactory::get($definition['type']);\n+ $field->setName($name);\n+ $field->setDefinition($definition, $name);\n+\n+ return $field;\n+ }\n+\n+ public function selectoptionsfromarray(Field $field)\n+ {\n+ $values = $field->getDefinition()->get('values');\n+ $currentValues = $field->getValue();\n+\n+ $options = [];\n+\n+ if ($field->getDefinition()->get('required', false)) {\n+ $options[] = [\n+ 'key' => '',\n+ 'value' => '',\n+ 'selected' => false,\n+ ];\n+ }\n+\n+ foreach ($values as $key => $value) {\n+ $options[] = [\n+ 'key' => $key,\n+ 'value' => $value,\n+ 'selected' => in_array($key, $currentValues),\n+ ];\n+ }\n+\n+ return $options;\n+\n+ }\n+}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "templates/_base/layout.twig", "new_path": "templates/_base/layout.twig", "diff": "<link href=\"https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700\" rel=\"stylesheet\">\n<link rel=\"stylesheet\" href=\"https://use.fontawesome.com/releases/v5.3.1/css/all.css\" integrity=\"sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU\" crossorigin=\"anonymous\">\n<link rel=\"stylesheet\" type=\"text/css\" href=\"https://cdn.jsdelivr.net/npm/semantic-ui@2.4.0/dist/semantic.min.css\">\n+ <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.6/css/selectize.min.css\" integrity=\"sha256-EhmqrzYSImS7269rfDxk4H+AHDyu/KwV1d8FDgIXScI=\" crossorigin=\"anonymous\" />\n<link rel=\"stylesheet\" type=\"text/css\" href=\"{{ asset('assets/bolt.css') }}\">\n{% endblock %}\n</head>\n{% block javascripts %}\n<script src=\"{{ asset('assets/bolt.js') }}\"></script>\n<script src=\"https://cdn.jsdelivr.net/npm/semantic-ui@2.4.0/dist/semantic.min.js\"></script>\n+ <script src=\"https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.6/js/selectize.min.js\" integrity=\"sha256-zwkv+PhVN/CSaFNLrcQ/1vQd3vviSPiOEDvu2GxYxQc=\" crossorigin=\"anonymous\"></script>\n{% endblock %}\n</body>\n" }, { "change_type": "ADD", "old_path": null, "new_path": "templates/editcontent/fields/select.twig", "diff": "+{% extends '@bolt/editcontent/fields/_base.twig' %}\n+\n+{% block field %}\n+\n+ {% set options = selectoptionsfromarray(field) %}\n+\n+ <label>{{ label }}</label>\n+ <select name=\"{{ name }}\" class=\"{{ class }}\" id=\"{{ name }}\">\n+ {% for option in options %}\n+ <option value=\"{{ option.key }}\" {{ option.selected ? 'selected' : '' }}>{{ option.value }}</option>\n+ {% endfor %}\n+ </select>\n+\n+{% endblock %}\n+\n+{% block javascripts %}\n+ {{ parent() }}\n+ <script>\n+ document.addEventListener(\"DOMContentLoaded\", function() {\n+ $('#{{ name }}').selectize({\n+ create: true,\n+ sortField: 'text'\n+ });\n+ });\n+ </script>\n+{% endblock %}\n+\n+{% block stylesheets %}\n+{% endblock stylesheets %}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "yarn.lock", "new_path": "yarn.lock", "diff": "@@ -196,6 +196,11 @@ ansi-styles@^3.2.1:\ndependencies:\ncolor-convert \"^1.9.0\"\n+ansicolors@~0.2.1:\n+ version \"0.2.1\"\n+ resolved \"https://registry.yarnpkg.com/ansicolors/-/ansicolors-0.2.1.tgz#be089599097b74a5c9c4a84a0cdbcdb62bd87aef\"\n+ integrity sha1-vgiVmQl7dKXJxKhKDNvNtivYeu8=\n+\nanymatch@^1.3.0:\nversion \"1.3.0\"\nresolved \"https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.0.tgz#a3e52fa39168c825ff57b0248126ce5a8ff95507\"\n@@ -359,7 +364,7 @@ async@^2.1.2:\ndependencies:\nlodash \"^4.14.0\"\n-async@^2.4.1:\n+async@^2.4.1, async@^2.6.0:\nversion \"2.6.1\"\nresolved \"https://registry.yarnpkg.com/async/-/async-2.6.1.tgz#b245a23ca71930044ec53fa46aa00a3e87c6a610\"\nintegrity sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==\n@@ -1273,6 +1278,14 @@ caniuse-lite@^1.0.30000684:\nresolved \"https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000696.tgz#30f2695d2a01a0dfd779a26ab83f4d134b3da5cc\"\nintegrity sha1-MPJpXSoBoN/XeaJquD9NE0s9pcw=\n+cardinal@^1.0.0:\n+ version \"1.0.0\"\n+ resolved \"https://registry.yarnpkg.com/cardinal/-/cardinal-1.0.0.tgz#50e21c1b0aa37729f9377def196b5a9cec932ee9\"\n+ integrity sha1-UOIcGwqjdyn5N33vGWtanOyTLuk=\n+ dependencies:\n+ ansicolors \"~0.2.1\"\n+ redeyed \"~1.0.0\"\n+\ncaseless@~0.12.0:\nversion \"0.12.0\"\nresolved \"https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc\"\n@@ -1835,6 +1848,11 @@ csso@~2.3.1:\nclap \"^1.0.9\"\nsource-map \"^0.5.3\"\n+csv-parse@^2.0.0:\n+ version \"2.5.0\"\n+ resolved \"https://registry.yarnpkg.com/csv-parse/-/csv-parse-2.5.0.tgz#65748997ecc3719c594622db1b9ea0e2eb7d56bb\"\n+ integrity sha512-4OcjOJQByI0YDU5COYw9HAqjo8/MOLLmT9EKyMCXUzgvh30vS1SlMK+Ho84IH5exN44cSnrYecw/7Zpu2m4lkA==\n+\ncurrently-unhandled@^0.4.1:\nversion \"0.4.1\"\nresolved \"https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea\"\n@@ -2256,6 +2274,11 @@ esprima@^4.0.0:\nresolved \"https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71\"\nintegrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==\n+esprima@~3.0.0:\n+ version \"3.0.0\"\n+ resolved \"https://registry.yarnpkg.com/esprima/-/esprima-3.0.0.tgz#53cf247acda77313e551c3aa2e73342d3fb4f7d9\"\n+ integrity sha1-U88kes2ncxPlUcOqLnM0LT+099k=\n+\nesrecurse@^4.1.0:\nversion \"4.2.1\"\nresolved \"https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf\"\n@@ -3114,6 +3137,11 @@ https-browserify@0.0.1:\nresolved \"https://registry.yarnpkg.com/https-browserify/-/https-browserify-0.0.1.tgz#3f91365cabe60b77ed0ebba24b454e3e09d95a82\"\nintegrity sha1-P5E2XKvmC3ftDruiS0VOPgnZWoI=\n+humanize@^0.0.9:\n+ version \"0.0.9\"\n+ resolved \"https://registry.yarnpkg.com/humanize/-/humanize-0.0.9.tgz#1994ffaecdfe9c441ed2bdac7452b7bb4c9e41a4\"\n+ integrity sha1-GZT/rs3+nEQe0r2sdFK3u0yeQaQ=\n+\niconv-lite@^0.4.4:\nversion \"0.4.24\"\nresolved \"https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b\"\n@@ -4043,6 +4071,11 @@ micromatch@^3.1.4:\nsnapdragon \"^0.8.1\"\nto-regex \"^3.0.2\"\n+microplugin@0.0.3:\n+ version \"0.0.3\"\n+ resolved \"https://registry.yarnpkg.com/microplugin/-/microplugin-0.0.3.tgz#1fc2e1bb7c9e19e82bd84bba9137bbe71250d8cd\"\n+ integrity sha1-H8Lhu3yeGegr2Eu6kTe75xJQ2M0=\n+\nmiller-rabin@^4.0.0:\nversion \"4.0.0\"\nresolved \"https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.0.tgz#4a62fb1d42933c05583982f4c716f6fb9e6c6d3d\"\n@@ -4122,6 +4155,11 @@ minimist@^1.1.3, minimist@^1.2.0:\nresolved \"https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284\"\nintegrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=\n+minimist@~0.0.1:\n+ version \"0.0.10\"\n+ resolved \"https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf\"\n+ integrity sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=\n+\nminipass@^2.2.1, minipass@^2.3.3:\nversion \"2.3.4\"\nresolved \"https://registry.yarnpkg.com/minipass/-/minipass-2.3.4.tgz#4768d7605ed6194d6d576169b9e12ef71e9d9957\"\n@@ -4524,6 +4562,14 @@ opn@4.0.2:\nobject-assign \"^4.0.1\"\npinkie-promise \"^2.0.0\"\n+optimist@^0.6.1:\n+ version \"0.6.1\"\n+ resolved \"https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686\"\n+ integrity sha1-2j6nRob6IaGaERwybpDrFaAZZoY=\n+ dependencies:\n+ minimist \"~0.0.1\"\n+ wordwrap \"~0.0.2\"\n+\noriginal@>=0.0.5:\nversion \"1.0.0\"\nresolved \"https://registry.yarnpkg.com/original/-/original-1.0.0.tgz#9147f93fa1696d04be61e01bd50baeaca656bd3b\"\n@@ -5342,6 +5388,13 @@ redent@^1.0.0:\nindent-string \"^2.1.0\"\nstrip-indent \"^1.0.1\"\n+redeyed@~1.0.0:\n+ version \"1.0.1\"\n+ resolved \"https://registry.yarnpkg.com/redeyed/-/redeyed-1.0.1.tgz#e96c193b40c0816b00aec842698e61185e55498a\"\n+ integrity sha1-6WwZO0DAgWsArshCaY5hGF5VSYo=\n+ dependencies:\n+ esprima \"~3.0.0\"\n+\nreduce-css-calc@^1.2.6:\nversion \"1.3.0\"\nresolved \"https://registry.yarnpkg.com/reduce-css-calc/-/reduce-css-calc-1.3.0.tgz#747c914e049614a4c9cfbba629871ad1d2927716\"\n@@ -5714,6 +5767,14 @@ select-hose@^2.0.0:\nresolved \"https://registry.yarnpkg.com/select-hose/-/select-hose-2.0.0.tgz#625d8658f865af43ec962bfc376a37359a4994ca\"\nintegrity sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo=\n+selectize@^0.12.6:\n+ version \"0.12.6\"\n+ resolved \"https://registry.yarnpkg.com/selectize/-/selectize-0.12.6.tgz#c2cf08cbaa4cb06c5e99bb452919d71b080690d6\"\n+ integrity sha512-bWO5A7G+I8+QXyjLfQUgh31VI4WKYagUZQxAXlDyUmDDNrFxrASV0W9hxCOl0XJ/XQ1dZEu3G9HjXV4Wj0yb6w==\n+ dependencies:\n+ microplugin \"0.0.3\"\n+ sifter \"^0.5.1\"\n+\nselfsigned@^1.9.1:\nversion \"1.9.1\"\nresolved \"https://registry.yarnpkg.com/selfsigned/-/selfsigned-1.9.1.tgz#cdda4492d70d486570f87c65546023558e1dfa5a\"\n@@ -5834,6 +5895,17 @@ shallow-clone@^1.0.0:\nkind-of \"^5.0.0\"\nmixin-object \"^2.0.1\"\n+sifter@^0.5.1:\n+ version \"0.5.3\"\n+ resolved \"https://registry.yarnpkg.com/sifter/-/sifter-0.5.3.tgz#5e6507fe8c114b2b28d90b6bf4e5b636e611e48b\"\n+ integrity sha1-XmUH/owRSyso2Qtr9OW2NuYR5Is=\n+ dependencies:\n+ async \"^2.6.0\"\n+ cardinal \"^1.0.0\"\n+ csv-parse \"^2.0.0\"\n+ humanize \"^0.0.9\"\n+ optimist \"^0.6.1\"\n+\nsignal-exit@^3.0.0:\nversion \"3.0.2\"\nresolved \"https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d\"\n@@ -6842,6 +6914,11 @@ wordwrap@0.0.2:\nresolved \"https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f\"\nintegrity sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=\n+wordwrap@~0.0.2:\n+ version \"0.0.3\"\n+ resolved \"https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107\"\n+ integrity sha1-o9XabNXAvAAI03I0u68b7WMFkQc=\n+\nworkbox-background-sync@^3.6.2:\nversion \"3.6.2\"\nresolved \"https://registry.yarnpkg.com/workbox-background-sync/-/workbox-background-sync-3.6.2.tgz#a8e95c6ed0e267fa100aaebd81568b86d81e032e\"\n" } ]
PHP
MIT License
bolt/core
Working on select fields
95,132
08.10.2018 15:22:37
-7,200
7d67152a171be4a09750609fe3eee17603ee00c2
Read Bolt's `config.yaml` in Kernel
[ { "change_type": "MODIFY", "old_path": "config/bolt/config.yaml", "new_path": "config/bolt/config.yaml", "diff": "#\n# If you're trying out Bolt, just keep it set to SQLite for now.\ndatabase:\n- driver: sqlite\n- databasename: bolt\n+ url: '%env(DATABASE_URL)%'\n# The name of the website\nsitename: A sample site in CONFIG\n" }, { "change_type": "MODIFY", "old_path": "config/packages/doctrine.yaml", "new_path": "config/packages/doctrine.yaml", "diff": "@@ -9,8 +9,7 @@ doctrine:\ndriver: 'pdo_sqlite'\nserver_version: '3.15'\ncharset: utf8mb4\n-\n- url: '%env(resolve:DATABASE_URL)%'\n+ url: '%bolt.database.url%'\norm:\nauto_generate_proxy_classes: '%kernel.debug%'\nnaming_strategy: doctrine.orm.naming_strategy.underscore\n" }, { "change_type": "MODIFY", "old_path": "src/Configuration/Config.php", "new_path": "src/Configuration/Config.php", "diff": "@@ -81,38 +81,6 @@ class Config\nreturn $config;\n}\n- /**\n- * @return array\n- */\n- public function getParameters(): array\n- {\n- $array = $this->data->get('general')->toArray();\n-\n- return $this->flatten($array);\n- }\n-\n- /**\n- * @param array $array\n- * @param string $prefix\n- *\n- * @return array\n- */\n- private function flatten(array $array, string $prefix = ''): array\n- {\n- $result = [];\n- foreach ($array as $key => $value) {\n- if (is_int($key)) {\n- $result[trim($prefix, '.')][] = $value;\n- } elseif (is_array($value)) {\n- $result = $result + $this->flatten($value, $prefix . $key . '.');\n- } else {\n- $result[$prefix . $key] = $value;\n- }\n- }\n-\n- return $result;\n- }\n-\n/**\n* Get a config value, using a path.\n*\n" }, { "change_type": "MODIFY", "old_path": "src/Kernel.php", "new_path": "src/Kernel.php", "diff": "@@ -4,13 +4,14 @@ declare(strict_types=1);\nnamespace Bolt;\n-use Bolt\\Configuration\\Config;\nuse Symfony\\Bundle\\FrameworkBundle\\Kernel\\MicroKernelTrait;\n+use Symfony\\Component\\Config\\FileLocator;\nuse Symfony\\Component\\Config\\Loader\\LoaderInterface;\nuse Symfony\\Component\\Config\\Resource\\FileResource;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\HttpKernel\\Kernel as BaseKernel;\nuse Symfony\\Component\\Routing\\RouteCollectionBuilder;\n+use Symfony\\Component\\Yaml\\Yaml;\nclass Kernel extends BaseKernel\n{\n@@ -44,11 +45,17 @@ class Kernel extends BaseKernel\n$container->setParameter('container.dumper.inline_class_loader', true);\n$confDir = $this->getProjectDir() . '/config';\n- $config = new Config();\n- foreach ($config->getParameters() as $key => $value) {\n+ $fileLocator = new FileLocator([ $confDir . '/bolt' ]);\n+ $fileName = $fileLocator->locate('config.yaml', null, true);\n+\n+ $yaml = Yaml::parseFile($fileName);\n+ unset($yaml['__nodes']);\n+\n+ $container->set('bolt.config.general', $yaml);\n+\n+ foreach ($this->flattenKeys($yaml) as $key => $value) {\n$container->setParameter('bolt.' . $key, $value);\n}\n- $container->set('config', $config);\n$loader->load($confDir . '/{packages}/*' . self::CONFIG_EXTS, 'glob');\n$loader->load($confDir . '/{packages}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, 'glob');\n@@ -64,4 +71,26 @@ class Kernel extends BaseKernel\n$routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, '/', 'glob');\n$routes->import($confDir . '/{routes}' . self::CONFIG_EXTS, '/', 'glob');\n}\n+\n+ /**\n+ * @param array $array\n+ * @param string $prefix\n+ *\n+ * @return array\n+ */\n+ private function flattenKeys(array $array, string $prefix = ''): array\n+ {\n+ $result = [];\n+ foreach ($array as $key => $value) {\n+ if (is_int($key)) {\n+ $result[trim($prefix, '.')][] = $value;\n+ } elseif(is_array($value)) {\n+ $result = $result + $this->flattenKeys($value, $prefix . $key . '.');\n+ } else {\n+ $result[$prefix . $key] = $value;\n+ }\n+ }\n+\n+ return $result;\n+ }\n}\n" } ]
PHP
MIT License
bolt/core
Read Bolt's `config.yaml` in Kernel
95,144
09.10.2018 12:27:35
-7,200
ca2cbb5796ce3f76727a91de8000b4af5674bc0e
Tweaking symfony deps.
[ { "change_type": "MODIFY", "old_path": "composer.json", "new_path": "composer.json", "diff": "\"symfony/serializer\": \"4.2.x-dev\",\n\"symfony/swiftmailer-bundle\": \"^3.1\",\n\"symfony/translation\": \"4.2.x-dev\",\n+ \"symfony/twig-bridge\": \"4.2.x-dev\",\n\"symfony/yaml\": \"4.2.x-dev\",\n\"tightenco/collect\": \"^5.7\",\n\"twig/extensions\": \"^1.5\",\n" }, { "change_type": "MODIFY", "old_path": "composer.lock", "new_path": "composer.lock", "diff": "\"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies\",\n\"This file is @generated automatically\"\n],\n- \"content-hash\": \"e4b1bf44667a1f259a22ae4f7ed56b80\",\n+ \"content-hash\": \"c9ac7ccd91ed0988c1bdb51f372ed1f6\",\n\"packages\": [\n{\n\"name\": \"api-platform/api-pack\",\n},\n{\n\"name\": \"symfony/twig-bridge\",\n- \"version\": \"v4.1.6\",\n+ \"version\": \"dev-master\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/twig-bridge.git\",\n- \"reference\": \"7af4d9e7c38c1eb8c0d4e2528c33e6d23728ff7e\"\n+ \"reference\": \"036c679bac1ee3316873c65a0307b1b421205a0a\"\n},\n\"dist\": {\n\"type\": \"zip\",\n- \"url\": \"https://api.github.com/repos/symfony/twig-bridge/zipball/7af4d9e7c38c1eb8c0d4e2528c33e6d23728ff7e\",\n- \"reference\": \"7af4d9e7c38c1eb8c0d4e2528c33e6d23728ff7e\",\n+ \"url\": \"https://api.github.com/repos/symfony/twig-bridge/zipball/036c679bac1ee3316873c65a0307b1b421205a0a\",\n+ \"reference\": \"036c679bac1ee3316873c65a0307b1b421205a0a\",\n\"shasum\": \"\"\n},\n\"require\": {\n},\n\"conflict\": {\n\"symfony/console\": \"<3.4\",\n- \"symfony/form\": \"<4.1.2\"\n+ \"symfony/form\": \"<4.1.2\",\n+ \"symfony/translation\": \"<4.2\"\n},\n\"require-dev\": {\n\"symfony/asset\": \"~3.4|~4.0\",\n\"symfony/security-acl\": \"~2.8|~3.0\",\n\"symfony/stopwatch\": \"~3.4|~4.0\",\n\"symfony/templating\": \"~3.4|~4.0\",\n- \"symfony/translation\": \"~3.4|~4.0\",\n+ \"symfony/translation\": \"~4.2\",\n\"symfony/var-dumper\": \"~3.4|~4.0\",\n\"symfony/web-link\": \"~3.4|~4.0\",\n\"symfony/workflow\": \"~3.4|~4.0\",\n\"type\": \"symfony-bridge\",\n\"extra\": {\n\"branch-alias\": {\n- \"dev-master\": \"4.1-dev\"\n+ \"dev-master\": \"4.2-dev\"\n}\n},\n\"autoload\": {\n],\n\"description\": \"Symfony Twig Bridge\",\n\"homepage\": \"https://symfony.com\",\n- \"time\": \"2018-10-02T12:40:59+00:00\"\n+ \"time\": \"2018-10-06T16:22:22+00:00\"\n},\n{\n\"name\": \"symfony/twig-bundle\",\n\"symfony/security-bundle\": 20,\n\"symfony/serializer\": 20,\n\"symfony/translation\": 20,\n+ \"symfony/twig-bridge\": 20,\n\"symfony/yaml\": 20,\n\"symfony/browser-kit\": 20,\n\"symfony/css-selector\": 20,\n" } ]
PHP
MIT License
bolt/core
Tweaking symfony deps.
95,168
10.10.2018 11:27:40
-7,200
ce0f7848b8170bdf92dbad6e86ca30d64b75e7ee
Don't generate service workers scripts
[ { "change_type": "MODIFY", "old_path": "webpack.config.js", "new_path": "webpack.config.js", "diff": "@@ -20,14 +20,14 @@ Encore\n// .enableVersioning()\n// Workbox should always be the last plugin to add @see: https://developers.google.com/web/tools/workbox/guides/codelabs/webpack#optional-config\n- .addPlugin(\n+ /* .addPlugin(\nnew WorkboxPlugin.GenerateSW({\n// these options encourage the ServiceWorkers to get in there fast\n// and not allow any straggling \"old\" SWs to hang around\nclientsClaim: true,\nskipWaiting: false,\nimportsDirectory: 'sw/',\n- }))\n+ })) */\n;\n// export the final configuration\n" } ]
PHP
MIT License
bolt/core
Don't generate service workers scripts
95,168
10.10.2018 13:52:00
-7,200
c6fa5e0361863c2f9d9a07845000f29664cd35a6
Install KnpMenuBundle
[ { "change_type": "MODIFY", "old_path": "composer.json", "new_path": "composer.json", "diff": "\"ezyang/htmlpurifier\": \"^4.10\",\n\"fzaninotto/faker\": \"^1.8\",\n\"guzzlehttp/guzzle\": \"^6.3\",\n+ \"knplabs/knp-menu-bundle\": \"^2.0\",\n\"league/glide-symfony\": \"^1.0\",\n\"miljar/php-exif\": \"^0.6.4\",\n\"nesbot/carbon\": \"^1.34\",\n" }, { "change_type": "MODIFY", "old_path": "composer.lock", "new_path": "composer.lock", "diff": "\"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies\",\n\"This file is @generated automatically\"\n],\n- \"content-hash\": \"c9ac7ccd91ed0988c1bdb51f372ed1f6\",\n+ \"content-hash\": \"84005069bff9117b5f6097a23ef59234\",\n\"packages\": [\n{\n\"name\": \"api-platform/api-pack\",\n],\n\"time\": \"2014-01-12T16:20:24+00:00\"\n},\n+ {\n+ \"name\": \"knplabs/knp-menu\",\n+ \"version\": \"2.3.0\",\n+ \"source\": {\n+ \"type\": \"git\",\n+ \"url\": \"https://github.com/KnpLabs/KnpMenu.git\",\n+ \"reference\": \"655630a1db0b72108262d1a844de3b1ba0885be5\"\n+ },\n+ \"dist\": {\n+ \"type\": \"zip\",\n+ \"url\": \"https://api.github.com/repos/KnpLabs/KnpMenu/zipball/655630a1db0b72108262d1a844de3b1ba0885be5\",\n+ \"reference\": \"655630a1db0b72108262d1a844de3b1ba0885be5\",\n+ \"shasum\": \"\"\n+ },\n+ \"require\": {\n+ \"php\": \">=5.6.0\"\n+ },\n+ \"require-dev\": {\n+ \"psr/container\": \"^1.0\",\n+ \"symfony/http-foundation\": \"~2.4|~3.0|^4.0\",\n+ \"symfony/phpunit-bridge\": \"~3.3|^4.0\",\n+ \"symfony/routing\": \"~2.3|~3.0|^4.0\",\n+ \"twig/twig\": \"~1.16|~2.0\"\n+ },\n+ \"suggest\": {\n+ \"twig/twig\": \"for the TwigRenderer and the integration with your templates\"\n+ },\n+ \"type\": \"library\",\n+ \"extra\": {\n+ \"branch-alias\": {\n+ \"dev-master\": \"2.3-dev\"\n+ }\n+ },\n+ \"autoload\": {\n+ \"psr-4\": {\n+ \"Knp\\\\Menu\\\\\": \"src/Knp/Menu\"\n+ }\n+ },\n+ \"notification-url\": \"https://packagist.org/downloads/\",\n+ \"license\": [\n+ \"MIT\"\n+ ],\n+ \"authors\": [\n+ {\n+ \"name\": \"Christophe Coevoet\",\n+ \"email\": \"stof@notk.org\"\n+ },\n+ {\n+ \"name\": \"Symfony Community\",\n+ \"homepage\": \"https://github.com/KnpLabs/KnpMenu/contributors\"\n+ },\n+ {\n+ \"name\": \"KnpLabs\",\n+ \"homepage\": \"https://knplabs.com\"\n+ }\n+ ],\n+ \"description\": \"An object oriented menu library\",\n+ \"homepage\": \"https://knplabs.com\",\n+ \"keywords\": [\n+ \"menu\",\n+ \"tree\"\n+ ],\n+ \"time\": \"2017-11-18T20:49:26+00:00\"\n+ },\n+ {\n+ \"name\": \"knplabs/knp-menu-bundle\",\n+ \"version\": \"v2.2.1\",\n+ \"source\": {\n+ \"type\": \"git\",\n+ \"url\": \"https://github.com/KnpLabs/KnpMenuBundle.git\",\n+ \"reference\": \"6bea43eb84fc67c43ab2b43709194efffa8a8ac0\"\n+ },\n+ \"dist\": {\n+ \"type\": \"zip\",\n+ \"url\": \"https://api.github.com/repos/KnpLabs/KnpMenuBundle/zipball/6bea43eb84fc67c43ab2b43709194efffa8a8ac0\",\n+ \"reference\": \"6bea43eb84fc67c43ab2b43709194efffa8a8ac0\",\n+ \"shasum\": \"\"\n+ },\n+ \"require\": {\n+ \"knplabs/knp-menu\": \"~2.3\",\n+ \"php\": \"^5.6 || ^7\",\n+ \"symfony/framework-bundle\": \"~2.7|~3.0 | ^4.0\"\n+ },\n+ \"require-dev\": {\n+ \"symfony/expression-language\": \"~2.7|~3.0 | ^4.0\",\n+ \"symfony/phpunit-bridge\": \"^3.3 | ^4.0\",\n+ \"symfony/templating\": \"~2.7|~3.0 | ^4.0\"\n+ },\n+ \"type\": \"symfony-bundle\",\n+ \"extra\": {\n+ \"branch-alias\": {\n+ \"dev-master\": \"2.2.x-dev\"\n+ }\n+ },\n+ \"autoload\": {\n+ \"psr-4\": {\n+ \"Knp\\\\Bundle\\\\MenuBundle\\\\\": \"src\"\n+ }\n+ },\n+ \"notification-url\": \"https://packagist.org/downloads/\",\n+ \"license\": [\n+ \"MIT\"\n+ ],\n+ \"authors\": [\n+ {\n+ \"name\": \"Christophe Coevoet\",\n+ \"email\": \"stof@notk.org\"\n+ },\n+ {\n+ \"name\": \"Knplabs\",\n+ \"homepage\": \"http://knplabs.com\"\n+ },\n+ {\n+ \"name\": \"Symfony Community\",\n+ \"homepage\": \"https://github.com/KnpLabs/KnpMenuBundle/contributors\"\n+ }\n+ ],\n+ \"description\": \"This bundle provides an integration of the KnpMenu library\",\n+ \"keywords\": [\n+ \"menu\"\n+ ],\n+ \"time\": \"2017-12-24T16:32:39+00:00\"\n+ },\n{\n\"name\": \"league/flysystem\",\n\"version\": \"1.0.47\",\n" }, { "change_type": "MODIFY", "old_path": "config/bundles.php", "new_path": "config/bundles.php", "diff": "@@ -20,4 +20,5 @@ return [\nSymfony\\Bundle\\WebProfilerBundle\\WebProfilerBundle::class => ['dev' => true, 'test' => true],\nSymfony\\Bundle\\WebServerBundle\\WebServerBundle::class => ['dev' => true],\nWhiteOctober\\PagerfantaBundle\\WhiteOctoberPagerfantaBundle::class => ['all' => true],\n+ Knp\\Bundle\\MenuBundle\\KnpMenuBundle::class => ['all' => true],\n];\n" }, { "change_type": "MODIFY", "old_path": "symfony.lock", "new_path": "symfony.lock", "diff": "\"jdorn/sql-formatter\": {\n\"version\": \"v1.2.17\"\n},\n+ \"knplabs/knp-menu\": {\n+ \"version\": \"2.3.0\"\n+ },\n+ \"knplabs/knp-menu-bundle\": {\n+ \"version\": \"v2.2.1\"\n+ },\n\"league/flysystem\": {\n\"version\": \"1.0.47\"\n},\n" } ]
PHP
MIT License
bolt/core
Install KnpMenuBundle
95,168
11.10.2018 15:30:24
-7,200
e9420fa68a850ff7d999561ef0c435f0f3404af4
Build Sidebar menu with KnpMenuBundle
[ { "change_type": "MODIFY", "old_path": "config/services.yaml", "new_path": "config/services.yaml", "diff": "@@ -36,3 +36,8 @@ services:\narguments: []\ntags:\n- { name: doctrine.event_listener, event: postLoad }\n+ app.menu_builder:\n+ class: Bolt\\Content\\MenuBuilder\n+ arguments: [\"@knp_menu.factory\"]\n+ tags:\n+ - { name: knp_menu.menu_builder, method: createSidebarMenu, alias: sidebar } # The alias is what is used to retrieve the menu\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "src/Content/MenuBuilder.php", "new_path": "src/Content/MenuBuilder.php", "diff": "@@ -5,9 +5,12 @@ declare(strict_types=1);\nnamespace Bolt\\Content;\nuse Bolt\\Configuration\\Config;\n+use Knp\\Menu\\FactoryInterface;\nclass MenuBuilder\n{\n+ private $factory;\n+\nprivate $config;\n/**\n@@ -15,29 +18,30 @@ class MenuBuilder\n*\n* @param Config $config\n*/\n- public function __construct(Config $config)\n+ public function __construct(FactoryInterface $factory, Config $config)\n{\n$this->config = $config;\n+ $this->factory = $factory;\n}\n- public function get()\n+ public function createSidebarMenu()\n{\n- $menu = [\n- [\n+ $menu = $this->factory->createItem('root');\n+\n+ $menu->addChild('Dashboard', ['uri' => 'homepage', 'extras' => [\n'name' => 'Dashboard',\n'icon_one' => 'fa-tachometer-alt',\n'link' => '/bolt/',\n- ],\n- ];\n+ ]]);\n- $menu[] = [\n+ $menu->addChild('Content', ['uri' => 'content', 'extras' => [\n'name' => 'Content',\n'type' => 'separator',\n'icon_one' => 'fa-file',\n- ];\n+ ]]);\nforeach ($this->config->get('contenttypes') as $contenttype) {\n- $menu[] = [\n+ $menu->addChild($contenttype['name'], ['uri' => 'homepage', 'extras' => [\n'name' => $contenttype['name'],\n'icon_one' => $contenttype['icon_one'],\n'icon_many' => $contenttype['icon_many'],\n@@ -45,36 +49,62 @@ class MenuBuilder\n'contenttype' => $contenttype['slug'],\n'singleton' => $contenttype['singleton'],\n'active' => $contenttype['slug'] === 'pages' ? true : false,\n- ];\n+ ]]);\n}\n- $menu[] = [\n+ $menu->addChild('Settings', ['uri' => 'settings', 'extras' => [\n'name' => 'Settings',\n'type' => 'separator',\n'icon_one' => 'fa-wrench',\n- ];\n+ ]]);\n- $menu[] = [\n+ $menu->addChild('Configuration', ['uri' => 'configuration', 'extras' => [\n'name' => 'Configuration',\n'icon_one' => 'fa-flag',\n'link' => '/bolt/finder/config',\n- ];\n- $menu[] = [\n+ ]]);\n+\n+ $menu->addChild('Content Files', ['uri' => 'content-files', 'extras' => [\n'name' => 'Content Files',\n'icon_one' => 'fa-flag',\n'link' => '/bolt/finder/files',\n- ];\n- $menu[] = [\n+ ]]);\n+\n+ $menu->addChild('Theme Files', ['uri' => 'theme-files', 'extras' => [\n'name' => 'Theme Files',\n'icon_one' => 'fa-flag',\n'link' => '/bolt/finder/themes',\n- ];\n- $menu[] = [\n+ ]]);\n+\n+ $menu->addChild('Users', ['uri' => 'users', 'extras' => [\n'name' => 'Users',\n'icon_one' => 'fa-users',\n'link' => '/bolt/users',\n- ];\n+ ]]);\nreturn $menu;\n}\n+\n+\n+ public function getMenu()\n+ {\n+ $menu = $this->createSidebarMenu()->getChildren();\n+\n+ $menuData = [];\n+\n+ foreach ($menu as $child) {\n+ $menuData[] = [\n+ 'name' => $child->getLabel(),\n+ 'icon_one' => $child->getExtra('icon_one') ? $child->getExtra('icon_one') : null,\n+ 'icon_many' => $child->getExtra('icon_many') ? $child->getExtra('icon_many') : null,\n+ 'link' => $child->getExtra('link') ? $child->getExtra('link') : null,\n+ 'contenttype' => $child->getExtra('contenttype') ? $child->getExtra('contenttype') : null,\n+ 'singleton' => $child->getExtra('singleton') ? $child->getExtra('singleton') : null,\n+ 'type' => $child->getExtra('type') ? $child->getExtra('type') : null,\n+ 'active' => $child->getExtra('active') ? $child->getExtra('active') : null\n+ ];\n+ }\n+\n+ return $menuData;\n+ }\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/ContentHelperExtension.php", "new_path": "src/Twig/ContentHelperExtension.php", "diff": "@@ -43,9 +43,9 @@ class ContentHelperExtension extends AbstractExtension\npublic function sidebarmenu()\n{\n- $menu = $this->menuBuilder->get();\n+ $menu = $this->menuBuilder->getMenu();\n- return $menu;\n+ return json_encode($menu);\n}\npublic function fieldfactory($definition, $name = null)\n" }, { "change_type": "MODIFY", "old_path": "templates/_base/layout.twig", "new_path": "templates/_base/layout.twig", "diff": "</header>\n<div id=\"sidebar\">\n- <Sidebar sidebarmenudata=\"{{ sidebarmenu()|json_encode() }}\">side</Sidebar>\n+ <Sidebar sidebarmenudata=\"{{ sidebarmenu() }}\">side</Sidebar>\n</div>\n<div id=\"{% block container %}content{% endblock %}\">\n" } ]
PHP
MIT License
bolt/core
Build Sidebar menu with KnpMenuBundle
95,144
11.10.2018 16:50:30
-7,200
87af80e037d05fe54c6072422c84dbbbd45bfd61
Splitting up fields: No more inline JS and CSS
[ { "change_type": "MODIFY", "old_path": "templates/_base/layout.twig", "new_path": "templates/_base/layout.twig", "diff": "<link href=\"https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700\" rel=\"stylesheet\">\n<link rel=\"stylesheet\" href=\"https://use.fontawesome.com/releases/v5.3.1/css/all.css\" integrity=\"sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU\" crossorigin=\"anonymous\">\n<link rel=\"stylesheet\" type=\"text/css\" href=\"https://cdn.jsdelivr.net/npm/semantic-ui@2.4.0/dist/semantic.min.css\">\n- <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.6/css/selectize.min.css\" integrity=\"sha256-EhmqrzYSImS7269rfDxk4H+AHDyu/KwV1d8FDgIXScI=\" crossorigin=\"anonymous\" />\n<link rel=\"stylesheet\" type=\"text/css\" href=\"{{ asset('assets/bolt.css') }}\">\n{% endblock %}\n</head>\n{% block javascripts %}\n<script src=\"{{ asset('assets/bolt.js') }}\"></script>\n<script src=\"https://cdn.jsdelivr.net/npm/semantic-ui@2.4.0/dist/semantic.min.js\"></script>\n- <script src=\"https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.6/js/standalone/selectize.min.js\" integrity=\"sha256-+C0A5Ilqmu4QcSPxrlGpaZxJ04VjsRjKu+G82kl5UJk=\" crossorigin=\"anonymous\"></script>\n{% endblock %}\n</body>\n" }, { "change_type": "MODIFY", "old_path": "templates/editcontent/edit.twig", "new_path": "templates/editcontent/edit.twig", "diff": "{#{{ dump(record.definition.fields) }}#}\n<form method=\"post\" class=\"ui form\" id=\"editcontent\">\n+\n<input type=\"hidden\" name=\"_csrf_token\" value=\"{{ csrf_token('editrecord') }}\">\n<!-- fields -->\n</form>\n-\n{% endblock %}\n{% block aside %}\n<input type=\"submit\" class=\"ui button primary\" value=\"Save\" form=\"editcontent\">\n-\n{% include '@bolt/editcontent/fields/text.twig' with {\n'label': 'field.id'|trans,\n'name': 'id',\n'attributes': 'form=\"editcontent\"',\n} %}\n-\n{#<input type=\"text\" name=\"author\" value=\"{{ record.author }}\">#}\n-\n-\n{% include '@bolt/editcontent/fields/datetime.twig' with {\n'label': 'field.createdAt'|trans,\n'name': 'createdAt',\n'value': record.depublishedAt,\n'attributes': 'form=\"editcontent\"',\n} %}\n-\n</form>\n</div>\n</div>\n-\n{% endblock aside %}\n+\n+{% block javascripts %}\n+{{ parent( )}}\n+ <!-- Javascript for fields -->\n+{% for key, fielddefinition in record.definition.fields %}\n+{% spaceless %}\n+ {% set type = fielddefinition.type %}\n+ {% set field = record.field(key) %}\n+ {% if not field %}\n+ {% set field = fieldfactory(fielddefinition, key) %}\n+ {% endif %}\n+{% endspaceless %}\n+{% include 'editcontent/javascripts/' ~ type ~ '.twig' ignore missing with { 'field': field} %}\n+{% endfor %}\n+\n+{# For the status selection #}\n+ {% include '@bolt/editcontent/javascripts/select.twig' with {\n+ 'name': 'status',\n+ } %}\n+{% endblock javascripts %}\n+\n+\n+{% block stylesheets %}\n+{{ parent( )}}\n+ <!-- Stylesheets for fields -->\n+{% for key, fielddefinition in record.definition.fields %}\n+{% spaceless %}\n+ {% set type = fielddefinition.type %}\n+ {% set field = record.field(key) %}\n+ {% if not field %}\n+ {% set field = fieldfactory(fielddefinition, key) %}\n+ {% endif %}\n+{% endspaceless %}\n+{% include 'editcontent/stylesheets/' ~ type ~ '.twig' ignore missing with { 'field': field} %}\n+{% endfor %}\n+\n+{% endblock stylesheets %}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "templates/editcontent/fields/_base.twig", "new_path": "templates/editcontent/fields/_base.twig", "diff": "+{%- spaceless -%}\n{% if not label|default() %}\n{% set label = field.definition.label|default(field.name|ucwords) ~ ':' %}\n{% endif %}\n{% endif %}\n{% if not id|default() %}\n- {% set id = 'field-' ~ field.name|default('name') %}\n+ {% set id = 'field-' ~ field.name|default(name) %}\n{% endif %}\n+{%- endspaceless -%}\n-\n+<!-- field \"{{ label }} {{ name }}\" -->\n<div class=\"field\">\n{% block field %}\n{% endblock %}\n</div>\n-\n-{% block stylesheets %}\n-{% endblock %}\n-\n-{% block javascripts %}\n-{% endblock %}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "templates/editcontent/fields/datetime.twig", "new_path": "templates/editcontent/fields/datetime.twig", "diff": "{% extends '@bolt/editcontent/fields/_base.twig' %}\n-\n{% block field %}\n-\n{# for timestamps, make sure it's formatted correctly #}\n{% if value.timestamp is defined %}\n{% set value = value|date(format='c') %}\n" }, { "change_type": "MODIFY", "old_path": "templates/editcontent/fields/markdown.twig", "new_path": "templates/editcontent/fields/markdown.twig", "diff": "<textarea name=\"{{ name }}\" class=\"{{ class }}\" id=\"{{ name }}\">{{ value }}</textarea>\n{% endblock %}\n-\n-{% block stylesheets %}\n- {{ parent() }}\n- <link rel=\"stylesheet\" href=\"{{ asset('assets/markdown.css') }}\">\n-\n-{% endblock %}\n-\n-{% block javascripts %}\n- {{ parent() }}\n- <script src=\"{{ asset('assets/markdown.js') }}\"></script>\n- <script>\n- var simplemde = new SimpleMDE({\n- element: document.getElementById(\"{{ name }}\"),\n- spellChecker: false,\n- status: false\n- });\n- </script>\n-{% endblock %}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "templates/editcontent/fields/select.twig", "new_path": "templates/editcontent/fields/select.twig", "diff": "</div>\n</div>\n{% endblock %}\n-\n-{% block javascripts %}\n- {{ parent() }}\n- <script>\n- document.addEventListener(\"DOMContentLoaded\", function() {\n- $('#{{ id }}').selectize({\n- create: true,\n- sortField: 'text',\n- maxItems: {{ multiple ? 'null' : '1' }},\n- closeAfterSelect: true\n- });\n- });\n- </script>\n-{% endblock %}\n-\n-{% block stylesheets %}\n-{% endblock stylesheets %}\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "templates/editcontent/javascripts/_base.twig", "diff": "+{%- spaceless -%}\n+{% if not name|default() %}\n+ {% set name = 'fields[' ~ field.name ~ ']' %}\n+{% endif %}\n+\n+{% if not value|default() %}\n+ {% if field.value is defined %}\n+ {% set value = field.value|join|default() %}\n+ {% else %}\n+ {% set value = '' %}\n+ {% endif %}\n+{% endif %}\n+\n+{% if not id|default() %}\n+ {% set id = 'field-' ~ field.name|default(name) %}\n+{% endif %}\n+{%- endspaceless -%}\n+\n+{% block javascripts %}\n+\n+{% endblock %}\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "templates/editcontent/javascripts/markdown.twig", "diff": "+{% extends '@bolt/editcontent/javascripts/_base.twig' %}\n+\n+{% block javascripts %}\n+<script src=\"{{ asset('assets/markdown.js') }}\"></script>\n+<script>\n+ var simplemde = new SimpleMDE({\n+ element: document.getElementById(\"{{ name }}\"),\n+ spellChecker: false,\n+ status: false\n+ });\n+</script>\n+{% endblock %}\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "templates/editcontent/javascripts/select.twig", "diff": "+{% extends '@bolt/editcontent/javascripts/_base.twig' %}\n+\n+{% if field.definition is defined %}\n+ {% set multiple = field.definition.get('multiple') %}\n+{% else %}\n+ {% set multiple = false %}\n+{% endif %}\n+\n+{% block javascripts %}\n+ <script src=\"https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.6/js/standalone/selectize.min.js\" integrity=\"sha256-+C0A5Ilqmu4QcSPxrlGpaZxJ04VjsRjKu+G82kl5UJk=\" crossorigin=\"anonymous\"></script>\n+ <script>\n+ document.addEventListener(\"DOMContentLoaded\", function() {\n+ $('#{{ id }}').selectize({\n+ create: true,\n+ sortField: 'text',\n+ maxItems: {{ multiple ? 'null' : '1' }},\n+ closeAfterSelect: true\n+ });\n+ });\n+ </script>\n+{% endblock %}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "templates/editcontent/stylesheets/_base.twig", "diff": "+{%- spaceless -%}\n+\n+{% if not name|default() %}\n+ {% set name = 'fields[' ~ field.name ~ ']' %}\n+{% endif %}\n+\n+{% if not value|default() %}\n+ {% if field.value is defined %}\n+ {% set value = field.value|join|default() %}\n+ {% else %}\n+ {% set value = '' %}\n+ {% endif %}\n+{% endif %}\n+\n+{% if not id|default() %}\n+ {% set id = 'field-' ~ field.name|default(name) %}\n+{% endif %}\n+{%- endspaceless -%}\n+\n+{% block stylesheets %}\n+\n+{% endblock %}\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "templates/editcontent/stylesheets/markdown.twig", "diff": "+{% extends '@bolt/editcontent/stylesheets/_base.twig' %}\n+\n+{% block stylesheets %}\n+ <link rel=\"stylesheet\" href=\"{{ asset('assets/markdown.css') }}\">\n+{% endblock %}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "templates/editcontent/stylesheets/select.twig", "diff": "+{% extends '@bolt/editcontent/stylesheets/_base.twig' %}\n+\n+{% block stylesheets %}\n+ <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.6/css/selectize.min.css\" integrity=\"sha256-EhmqrzYSImS7269rfDxk4H+AHDyu/KwV1d8FDgIXScI=\" crossorigin=\"anonymous\" />\n+{% endblock %}\n" } ]
PHP
MIT License
bolt/core
Splitting up fields: No more inline JS and CSS
95,168
12.10.2018 13:30:00
-7,200
ecaf3731a67ef3b20cdffd249bd194602c71d809
Only allow GET operations in the API
[ { "change_type": "MODIFY", "old_path": "src/Entity/Content.php", "new_path": "src/Entity/Content.php", "diff": "@@ -16,7 +16,10 @@ use Doctrine\\ORM\\Mapping as ORM;\nuse Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface;\n/**\n- * @ApiResource\n+ * @ApiResource(\n+ * collectionOperations={\"get\"},\n+ * itemOperations={\"get\"}\n+ * )\n* @ApiFilter(SearchFilter::class)\n* @ORM\\Entity(repositoryClass=\"Bolt\\Repository\\ContentRepository\")\n* @ORM\\Table(name=\"bolt_content\")\n" } ]
PHP
MIT License
bolt/core
Only allow GET operations in the API
95,144
13.10.2018 11:55:21
-7,200
8904356ac6d6074b936888487af3fb073bf43365
Working on replacing Semantic
[ { "change_type": "MODIFY", "old_path": "assets/js/Components/DashboardNews.vue", "new_path": "assets/js/Components/DashboardNews.vue", "diff": "<template>\n<div>\n- <div class=\"ui card\" v-for=\"newsItem in news\" v-if=\"newsItem\" :key=\"newsItem.id\">\n- <div class=\"content\">\n- <div class=\"header\">{{ newsItem.title }}</div>\n- </div>\n- <div class=\"content\" v-html=\"newsItem.teaser\">\n- </div>\n+ <div class=\"card\" v-for=\"newsItem in news\" v-if=\"newsItem\" :key=\"newsItem.id\">\n+ <div class=\"card-header\">{{ newsItem.title }}</div>\n+ <div class=\"card-body\" v-html=\"newsItem.teaser\"></div>\n</div>\n</div>\n" }, { "change_type": "MODIFY", "old_path": "assets/js/Components/Sidebar.vue", "new_path": "assets/js/Components/Sidebar.vue", "diff": "<template>\n- <div class=\"ui vertical inverted borderless small menu\">\n- <div class=\"header item logo\">\n+ <nav class=\"nav flex-column nav-fill\">\n+ <div class=\"logo\">\n<h2>Bolt</h2>\n</div>\n<!-- TODO: Maybe we need to parse the data somewhere else -->\n<!-- separators -->\n<hr v-if=\"menuitem.type\"/>\n- <div v-if=\"menuitem.type\" class=\"item separator\">\n+ <div v-if=\"menuitem.type\" class=\"nav-item separator\">\n<i class=\"fas\" :class=\"menuitem.icon_one\"></i>\n{{ menuitem.name }}\n</div>\n<!-- Non-contenttype links -->\n- <a v-else-if=\"!menuitem.contenttype\" :href=\"menuitem.link\" class=\"item\" :key=\"menuitem.id\">\n+ <a v-else-if=\"!menuitem.contenttype\" :href=\"menuitem.link\" class=\"nav-item nav-link\" :key=\"menuitem.id\">\n<span v-if=\"!menuitem.type\" class=\"fa-stack\">\n<i class=\"fas fa-square fa-stack-2x\"></i>\n<i class=\"fas fa-stack-1x\" :class=\"menuitem.icon_one\"></i>\n</a>\n<!-- Contenttypes -->\n- <div v-else=\"\" class=\"ui dropdown item left pointing floating\" :key=\"menuitem.id\" :class=\"[ menuitem.active ? 'current' : '' ]\">\n- <i v-if=\"!menuitem.singleton\" class=\"dropdown icon\"></i>\n- <a :href=\"menuitem.link\">\n+\n+\n+ <div v-else=\"\" class=\"dropdown\" :key=\"menuitem.id\" :class=\"[ menuitem.active ? 'current' : '' ]\">\n+ <a :href=\"menuitem.link\" button class=\"nav-item nav-link dropdown-toggle\" type=\"button\" id=\"dropdownMenuButton\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" data-trigger=\"hover\">\n<span class=\"fa-stack\">\n<i class=\"fas fa-square fa-stack-2x\"></i>\n<i class=\"fas fa-stack-1x\" :class=\"menuitem.icon_many\"></i>\n</a>\n<!-- that are not Singleton -->\n- <div v-if=\"!menuitem.singleton\" class=\"menu\">\n- <a class=\"item\" :href=\"'/bolt/content/' + menuitem.contenttype\">\n+ <div v-if=\"!menuitem.singleton\" class=\"dropdown-menu\" aria-labelledby=\"dropdownMenuButton\">\n+ <a v-for=\"record in getRecordsPerContenttype(menuitem.contenttype)\" :key=\"record.id\" class=\"dropdown-item\" :href=\"'/bolt/edit/' + record.id\">\n+ <i class=\"fas icon\" :class=\"menuitem.icon_one\"></i>\n+ {{ record.magictitle }}\n+ </a>\n+ <div class=\"btn-group\" role=\"group\">\n+ <a class=\"btn btn-light btn-sm\" :href=\"'/bolt/content/' + menuitem.contenttype\">\n<i class=\"fas icon\" :class=\"menuitem.icon_one\"></i>\nView {{ menuitem.name }}\n</a>\n- <a class=\"item\" :href=\"'/bolt/edit/' + menuitem.contenttype\">\n+ <a class=\"btn btn-light btn-sm\" :href=\"'/bolt/edit/' + menuitem.contenttype\">\n<i class=\"fas fa-plus icon\"></i>\nNew {{ menuitem.name }}\n</a>\n- <div class=\"divider\"></div>\n- <a v-for=\"record in getRecordsPerContenttype(menuitem.contenttype)\" :key=\"record.id\" class=\"item\" :href=\"'/bolt/edit/' + record.id\">\n- <i class=\"fas icon\" :class=\"menuitem.icon_one\"></i>\n- {{ record.magictitle }}\n- </a>\n+ </div>\n</div>\n</div>\n</template>\n- </div>\n+ </nav>\n</template>\n<script>\n@@ -98,10 +100,7 @@ export default {\n<style lang=\"scss\">\n@import \"../../scss/settings\";\n-.ui.small.vertical.menu {\n- border-radius: 0;\n- width: auto;\n- font-size: 1rem;\n+nav.flex-column {\nbackground-color: $sidebar-background;\nhr {\n@@ -118,10 +117,11 @@ export default {\nmargin: 0;\n}\n- .item {\n+ .nav-item {\ncolor: #ddd !important;\npadding-top: 0.6rem;\npadding-bottom: 0.6rem;\n+ text-align: left;\na {\ncolor: #ddd !important;\n@@ -159,13 +159,35 @@ export default {\n}\n}\n- .menu.transition {\n- margin-left: -28px;\n- font-size: 0.9rem;\n+ .dropdown-menu {\n+ transform: translateX(140px) !important;\n+ padding-bottom: 0;\na {\n- padding: 0.5rem 1rem !important;\n+ padding: 0.25rem 0.75rem;\n+ }\n+\n+ .btn-group {\n+ width: 100%;\n+ background-color: #EEE;\n+ border-top: 1px solid #DDD;\n+ margin-top: 0.5rem;\n+ display: flex\n+ }\n+\n+ .btn {\n+ background-color: #EEE;\n+ border: 0;\n+ flex: 1;\n+ padding: 0.5rem 0;\n}\n+ .btn:hover {\n+ background-color: #CCC;\n+ border: 0;\n}\n+\n+\n+ }\n+\n}\n</style>\n" }, { "change_type": "MODIFY", "old_path": "assets/js/bolt.js", "new_path": "assets/js/bolt.js", "diff": "@@ -36,20 +36,20 @@ import \"semantic-ui-calendar/dist/calendar.css\";\nimport \"semantic-ui-calendar/dist/calendar\";\n$(document).ready(function() {\n- $(\".ui.dropdown\").dropdown({});\n-\n- $(\"#sidebar .ui.dropdown\").dropdown({\n- on: \"hover\",\n- transition: \"slide right\"\n- });\n-\n- $(\".ui.dropdown.fileselector\").dropdown({\n- transition: \"slide down\",\n- fullTextSearch: \"exact\",\n- preserveHTML: true\n- });\n-\n- $(\".ui.calendar\").calendar({\n- ampm: false\n- });\n+ // $(\".ui.dropdown\").dropdown({});\n+\n+ // $(\"#sidebar .ui.dropdown\").dropdown({\n+ // on: \"hover\",\n+ // transition: \"slide right\"\n+ // });\n+\n+ // $(\".ui.dropdown.fileselector\").dropdown({\n+ // transition: \"slide down\",\n+ // fullTextSearch: \"exact\",\n+ // preserveHTML: true\n+ // });\n+\n+ // $(\".ui.calendar\").calendar({\n+ // ampm: false\n+ // });\n});\n" }, { "change_type": "MODIFY", "old_path": "symfony.lock", "new_path": "symfony.lock", "diff": "\"ref\": \"85834af1496735f28d831489d12ab1921a875e0d\"\n}\n},\n- \"symfony/security-core\": {\n- \"version\": \"4.2-dev\"\n- },\n\"symfony/serializer\": {\n\"version\": \"v4.1.4\"\n},\n" }, { "change_type": "MODIFY", "old_path": "templates/_base/layout.twig", "new_path": "templates/_base/layout.twig", "diff": "{% block stylesheets %}\n<link href=\"https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700\" rel=\"stylesheet\">\n<link rel=\"stylesheet\" href=\"https://use.fontawesome.com/releases/v5.3.1/css/all.css\" integrity=\"sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU\" crossorigin=\"anonymous\">\n- <link rel=\"stylesheet\" type=\"text/css\" href=\"https://cdn.jsdelivr.net/npm/semantic-ui@2.4.0/dist/semantic.min.css\">\n+ <link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css\" integrity=\"sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO\" crossorigin=\"anonymous\">\n<link rel=\"stylesheet\" type=\"text/css\" href=\"{{ asset('assets/bolt.css') }}\">\n{% endblock %}\n</head>\n</div>\n{% block javascripts %}\n<script src=\"{{ asset('assets/bolt.js') }}\"></script>\n- <script src=\"https://cdn.jsdelivr.net/npm/semantic-ui@2.4.0/dist/semantic.min.js\"></script>\n+ <script src=\"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js\" integrity=\"sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49\" crossorigin=\"anonymous\"></script>\n+ <script src=\"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js\" integrity=\"sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy\" crossorigin=\"anonymous\"></script>\n{% endblock %}\n</body>\n" }, { "change_type": "MODIFY", "old_path": "templates/_partials/_widget_weather.twig", "new_path": "templates/_partials/_widget_weather.twig", "diff": "-<div class=\"ui card\">\n- <div class=\"image\"\n+<div class=\" card\">\n+ <div class=\"image card-img-top\"\nstyle=\"background-image: url(https://source.unsplash.com/400x240/?rain,sun,snow,storm,weather,sunny); height: 200px; padding-top: 60px;\">\n<center style='text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.4); color: #FFF;'>\n<span>Sunny, with occasional clouds</span><br>\n<span style=\"font-size: 200%;\"><i class=\"fas fa-sun\"></i> 18 &deg; C</span><br>\n<span>Den Haag, Netherlands</span>\n</center>\n-\n</div>\n- <div class=\"extra content\">\n+ <div class=\"card-body\">\n<a>\n<i class=\"fa fa-socks\"></i>\nThis is a random widget\n" } ]
PHP
MIT License
bolt/core
Working on replacing Semantic
95,144
13.10.2018 12:15:41
-7,200
cb2fe4f1ad2cbced5a0f211406a8f4a19803a707
Update assets/js/Components/Topbar.vue
[ { "change_type": "MODIFY", "old_path": "assets/js/Components/Topbar.vue", "new_path": "assets/js/Components/Topbar.vue", "diff": "@@ -41,6 +41,10 @@ module.exports = {\nmargin: 0 1rem 0 3rem;\n}\n+.nav-fill .nav-item {\n+ flex-grow: 0;\n+}\n+\n.nav-fill .nav-item.topbar-title {\nfont-family: \"Source Sans Pro\", serif;\nfont-size: 22px;\n@@ -53,6 +57,6 @@ module.exports = {\ndisplay: -webkit-box;\n-webkit-line-clamp: 1;\n-webkit-box-orient: vertical;\n- flex: 100 1 auto;\n+ flex-grow: 1;\n}\n</style>\n" } ]
PHP
MIT License
bolt/core
Update assets/js/Components/Topbar.vue
95,168
15.10.2018 15:55:25
-7,200
5aec9be92e2fe5fde173e9700128b9f8da057e5e
Fix some Twig Extension's namespace
[ { "change_type": "MODIFY", "old_path": "src/EventSubscriber/ControllerSubscriber.php", "new_path": "src/EventSubscriber/ControllerSubscriber.php", "diff": "@@ -4,7 +4,7 @@ declare(strict_types=1);\nnamespace Bolt\\EventSubscriber;\n-use Bolt\\Twig\\SourceCodeExtension;\n+use Bolt\\Twig\\Extension\\SourceCodeExtension;\nuse Symfony\\Component\\EventDispatcher\\EventSubscriberInterface;\nuse Symfony\\Component\\HttpKernel\\Event\\FilterControllerEvent;\nuse Symfony\\Component\\HttpKernel\\KernelEvents;\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/Extension/AppExtension.php", "new_path": "src/Twig/Extension/AppExtension.php", "diff": "declare(strict_types=1);\n-namespace Bolt\\Twig;\n+namespace Bolt\\Twig\\Extension;\nuse Bolt\\Helpers\\Excerpt;\nuse Bolt\\Utils\\Markdown;\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/Extension/ContentHelperExtension.php", "new_path": "src/Twig/Extension/ContentHelperExtension.php", "diff": "declare(strict_types=1);\n-namespace Bolt\\Twig;\n+namespace Bolt\\Twig\\Extension;\nuse Bolt\\Content\\FieldFactory;\nuse Bolt\\Content\\MenuBuilder;\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/Extension/HtmlExtension.php", "new_path": "src/Twig/Extension/HtmlExtension.php", "diff": "@@ -32,6 +32,7 @@ class HtmlExtension extends AbstractExtension\npublic function getFilters()\n{\n$safe = ['is_safe' => ['html']];\n+ $env = ['needs_environment' => true];\nreturn [\n// @codingStandardsIgnoreStart\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/Extension/ImageExtension.php", "new_path": "src/Twig/Extension/ImageExtension.php", "diff": "declare(strict_types=1);\n-namespace Bolt\\Twig;\n+namespace Bolt\\Twig\\Extension;\nuse Bolt\\Configuration\\Config;\nuse Bolt\\Entity\\Field;\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/Extension/SourceCodeExtension.php", "new_path": "src/Twig/Extension/SourceCodeExtension.php", "diff": "declare(strict_types=1);\n-namespace Bolt\\Twig;\n+namespace Bolt\\Twig\\Extension;\nuse Twig\\Environment;\nuse Twig\\Extension\\AbstractExtension;\n" }, { "change_type": "RENAME", "old_path": "src/Twig/Runtime/WidgetsRuntime.php", "new_path": "src/Twig/Runtime/WidgetRuntime.php", "diff": "" } ]
PHP
MIT License
bolt/core
Fix some Twig Extension's namespace
95,168
15.10.2018 16:42:48
-7,200
3d4a24e56d7a4f2e6510f7f8e61f37d8a0fa8c0d
Move excerpt function/filter to RecordRuntime.php
[ { "change_type": "MODIFY", "old_path": "src/Twig/Extension/AppExtension.php", "new_path": "src/Twig/Extension/AppExtension.php", "diff": "@@ -4,7 +4,6 @@ declare(strict_types=1);\nnamespace Bolt\\Twig\\Extension;\n-use Bolt\\Helpers\\Excerpt;\nuse Bolt\\Utils\\Markdown;\nuse Symfony\\Component\\Intl\\Intl;\nuse Twig\\Extension\\AbstractExtension;\n@@ -102,11 +101,4 @@ class AppExtension extends AbstractExtension\nreturn $this->locales;\n}\n-\n- public function excerpt($text, $length = 100)\n- {\n- $excerpter = new Excerpt($text);\n-\n- return $excerpter->getExcerpt((int) $length);\n- }\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/Extension/RecordExtension.php", "new_path": "src/Twig/Extension/RecordExtension.php", "diff": "namespace Bolt\\Twig\\Extension;\n+use Bolt\\Twig\\Runtime;\nuse Twig\\Extension\\AbstractExtension;\nuse Twig\\TwigFilter;\nuse Twig\\TwigFunction;\n@@ -21,7 +22,7 @@ class RecordExtension extends AbstractExtension\nreturn [\n// @codingStandardsIgnoreStart\n- new TwigFunction('excerpt', [Runtime\\RecordRuntime::class, 'dummy'], $safe),\n+ new TwigFunction('excerpt', [Runtime\\RecordRuntime::class, 'excerpt'], $safe),\nnew TwigFunction('listtemplates', [Runtime\\RecordRuntime::class, 'dummy']),\nnew TwigFunction('pager', [Runtime\\RecordRuntime::class, 'dummy'], $env + $safe),\n// @codingStandardsIgnoreEnd\n@@ -38,7 +39,7 @@ class RecordExtension extends AbstractExtension\nreturn [\n// @codingStandardsIgnoreStart\n- new TwigFilter('excerpt', [Runtime\\RecordRuntime::class, 'dummy'], $safe),\n+ new TwigFilter('excerpt', [Runtime\\RecordRuntime::class, 'excerpt'], $safe),\n// @codingStandardsIgnoreEnd\n];\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/Runtime/RecordRuntime.php", "new_path": "src/Twig/Runtime/RecordRuntime.php", "diff": "namespace Bolt\\Twig\\Runtime;\n+use Bolt\\Helpers\\Excerpt;\n+\n/**\n* Bolt specific Twig functions and filters that provide \\Bolt\\Legacy\\Content manipulation.\n*/\n@@ -11,4 +13,11 @@ class RecordRuntime\n{\nreturn $input;\n}\n+\n+ public function excerpt($text, $length = 100)\n+ {\n+ $excerpter = new Excerpt($text);\n+\n+ return $excerpter->getExcerpt((int) $length);\n+ }\n}\n" } ]
PHP
MIT License
bolt/core
Move excerpt function/filter to RecordRuntime.php
95,168
15.10.2018 16:43:24
-7,200
27184e7d05d08ee9f9bfbf57e60bc8ee46e7abad
Tag Runtime services in services.yml
[ { "change_type": "MODIFY", "old_path": "config/services.yaml", "new_path": "config/services.yaml", "diff": "@@ -31,6 +31,11 @@ services:\nresource: '../src/Controller'\ntags: ['controller.service_arguments']\n+ Bolt\\Twig\\Runtime\\:\n+ resource: '../src/Twig/Runtime/*'\n+ public: false\n+ tags: ['twig.runtime']\n+\ndoctrine.content_listener:\nclass: Bolt\\EventListener\\ContentListener\narguments: []\n" } ]
PHP
MIT License
bolt/core
Tag Runtime services in services.yml
95,144
15.10.2018 19:45:02
-7,200
0e48a026b5e2a75989569adf8cb61bb5558756e4
Working on replacing Semantic for Bootstrap
[ { "change_type": "MODIFY", "old_path": "templates/_macro/_macro.twig", "new_path": "templates/_macro/_macro.twig", "diff": "{% if action == 'held' %}\n{% set action = 'depublish' %}\n{% endif %}\n- <div href=\"#\" data-listing-cmd=\"record:{{ action }}\"><i class=\"fa {{ icon }}\"></i> {{ __(text) }}</div>\n+ <a class=\"dropdown-item\" data-listing-cmd=\"record:{{ action }}\"><i class=\"fa {{ icon }}\"></i> {{ __(text) }}</a>\n{% endmacro %}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "templates/_partials/_content_actions.twig", "new_path": "templates/_partials/_content_actions.twig", "diff": "{% set modifiable = true %}\n{% set permissions = { 'publish': true, 'depublish': true, 'create': true, 'delete': true } %}\n-\n-<div class=\"ui buttons small\">\n- <div class=\"ui button small has-dropdown\">\n- <a href=\"{{ path('bolt_edit_record', {'id': record.id}) }}\">\n+<div class=\"btn-group\">\n+ <a href=\"{{ path('bolt_edit_record', {'id': record.id}) }}\" class=\"btn btn-secondary\">\n<i class=\"fas fa-edit\"></i> {{ __('edit') }}\n</a>\n- </div>\n- <div class=\"ui floating pointing dropdown icon button small\">\n- <i class=\"dropdown icon\"></i>\n- <div class=\"menu\">\n+ <button type=\"button\" class=\"btn btn-secondary dropdown-toggle dropdown-toggle-split\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\">\n+ <span class=\"sr-only\">Toggle Dropdown</span>\n+ </button>\n+ <div class=\"dropdown-menu dropdown-menu-right\">\n+\n{% if record.status == \"published\" and record.link is not empty %}\n- <div class=\"item\">\n- <a href=\"{{ record.link }}\" target=\"_blank\">\n+ <a class=\"dropdown-item\" href=\"{{ record.link }}\" target=\"_blank\">\n<i class=\"fas fa-external-link-square-alt\"></i> {{ __('general.view-on-site') }}\n</a>\n- </div>\n{% endif %}\n{% if modifiable %}\n{% if record.status != 'published' %}\n{% if permissions.publish %}\n- <div class=\"item\">{{ macro.actionform(record, 'publish', 'fa-circle status-published', __('contenttypes.generic.publish',{'%contenttype%':record.definition.singular_name})) }}</div>\n+ {{ macro.actionform(record, 'publish', 'fa-circle status-published', __('contenttypes.generic.publish',{'%contenttype%':record.definition.singular_name})) }}\n{% endif %}\n{% else %}\n{% if permissions.depublish %}\n- <div class=\"item\">{{ macro.actionform(record, 'held', 'fa-circle status-held', __('general.status-change-held')) }}</div>\n- <div class=\"item\">{{ macro.actionform(record, 'draft', 'fa-circle status-draft', __('general.status-change-draft')) }}</div>\n-\n+ {{ macro.actionform(record, 'held', 'fa-circle status-held', __('general.status-change-held')) }}\n{% endif %}\n{% endif %}\n{% if permissions.create %}\n- <div class=\"item\">\n- <a href=\"{{ path('bolt_edit_record', {'id': record.id, 'duplicate': 1}) }}\">\n+ <a class=\"dropdown-item\" href=\"{{ path('bolt_edit_record', {'id': record.id, 'duplicate': 1}) }}\">\n<i class=\"fas fa-copy\"></i> {{ __('contenttypes.generic.duplicate', {'%contenttype%': record.definition.singular_name}) }}\n</a>\n- </div>\n{% endif %}\n{% if permissions.delete %}\n- <div class=\"item\">\n{{ macro.actionform(record, 'delete',\n'fa-trash',\n__('contenttypes.generic.delete', {'%contenttype%': record.definition.singular_name}),\n\"Are you sure you want to delete '\" ~ record.title ~ \"'?\" ) }}\n- </div>\n{% endif %}\n- <div class=\"divider\"></div>\n+ <div class=\"dropdown-divider\"></div>\n{% endif %}\n- <div class=\"item\">\n- <a class=\"nolink\">\n+\n+ <span class=\"dropdown-item\">\n{{ __('general.author') }}: <strong><i class=\"fas fa-user\"></i>\n{% set owner = record.author %}\n{% if owner %}\n<s>user {{ record.ownerid }}</s>\n{% endif %}\n</strong>\n- </a>\n- </div>\n- <div class=\"item\">\n- <a class=\"nolink\">{{ __('general.status-current') }}:\n- <strong> {{ record.status }}</strong></a>\n- </div>\n- <div class=\"item\">\n- <a class=\"nolink\">{{ __('general.slug') }}:\n+ </span>\n+\n+ <span class=\"dropdown-item\">{{ __('general.status-current') }}:\n+ <strong> {{ record.status }}</strong></span>\n+ <span class=\"dropdown-item\">{{ __('general.slug') }}:\n<code title=\"{{ record.slug }}\">{{ record.slug|excerpt(24) }}</code>\n- </a>\n- </div>\n- <div class=\"item\">\n- <a class=\"nolink\">{{ __('general.created-on') }}:\n+ </span>\n+ <span class=\"dropdown-item\">{{ __('general.created-on') }}:\n<i class=\"fas fa-asterisk\"></i> {{ record.datecreated|date(\"Y-m-d H:i\") }}\n- </a>\n- </div>\n- <div class=\"item\">\n- <a class=\"nolink\">{{ __('general.published-on') }}:\n+ </span>\n+ <span class=\"dropdown-item\">{{ __('general.published-on') }}:\n<i class=\"fas fa-calendar\"></i> {{ record.datepublish|date(\"Y-m-d H:i\") }}\n- </a>\n- </div>\n- <div class=\"item\">\n- <a class=\"nolink\">{{ __('general.last-edited-on') }}:\n+ </span>\n+ <span class=\"dropdown-item\">{{ __('general.last-edited-on') }}:\n<i class=\"fas fa-sync-alt\"></i> {{ record.datechanged|date(\"Y-m-d H:i\") }}\n- </a>\n- </div>\n+ </span>\n+{# --\n{% set taxonomytypes = record.taxonomy.grouped|default %}\n{% for type, taxonomies in taxonomytypes %}\n{% if taxonomies|length > 1 %}\n{% set taxlist = taxlist|merge([taxonomy.name]) %}\n{% endfor %}\n<div class=\"item\">\n- <a class=\"nolink\">{{ app.config.get('taxonomy')[type].name }}:\n+ <span class=\"dropdown-item\">{{ app.config.get('taxonomy')[type].name }}:\n<i class=\"fas fa-tag\"></i> {{ taxlist|join(\", \")[:24] }}\n- </a>\n+ </span>\n</div>\n{% else %}\n<div class=\"item\">\n{% set taxonomy = taxonomies|first %}\n- <a class=\"nolink\">{{ app.config.get('taxonomy')[type].singular_name }}:\n+ <span class=\"dropdown-item\">{{ app.config.get('taxonomy')[type].singular_name }}:\n<i class=\"fas fa-tag\"></i> {{ taxonomy.name[:24] }}\n- </a>\n+ </span>\n</div>\n{% endif %}\n{% endfor %}\n+-- #}\n</div>\n</div>\n-</div>\n" }, { "change_type": "MODIFY", "old_path": "templates/_partials/_content_listing.twig", "new_path": "templates/_partials/_content_listing.twig", "diff": "{% if records %}\n- <table class=\"ui very basic striped table\">\n+ <table class=\"table table-striped\">\n<thead>\n<tr>\n<th>Title / Excerpt</th>\n" }, { "change_type": "MODIFY", "old_path": "templates/_partials/_content_record_default.twig", "new_path": "templates/_partials/_content_record_default.twig", "diff": "-<tr class=\"top aligned\">\n+<tr>\n<td class=\"listing-excerpt\">\n<div class=\"clip-overflow\">{{ record.excerpt(400, true) }}</div>\n</td>\n" }, { "change_type": "MODIFY", "old_path": "templates/content/listing.twig", "new_path": "templates/content/listing.twig", "diff": "{% block aside %}\n- <div class=\"ui card\">\n- <div class=\"content\">\n- <div class=\"header\">Contentlisting</div>\n+ <div class=\"card\">\n+ <div class=\"card-header\">\n+ Contentlisting\n</div>\n- <div class=\"content\">\n+ <div class=\"card-body\">\n(filtering options go here)\n</div>\n</div>\n" }, { "change_type": "MODIFY", "old_path": "templates/editcontent/edit.twig", "new_path": "templates/editcontent/edit.twig", "diff": "{% extends '@bolt/_base/layout.twig' %}\n-{% set alltypes = [] %}\n+{% set alltypes = ['select'] %}\n{% for key, fielddefinition in record.definition.fields %}\n{% set alltypes = alltypes|merge([fielddefinition.type]) %}\n{% endfor %}\n{{ dump(alltypes|unique) }}\n- <input type=\"submit\" class=\"ui button primary\" value=\"Save\">\n+ <input type=\"submit\" class=\"btn btn-primary\" value=\"Save\">\n</form>\n{% block aside %}\n-<div class=\"ui card\">\n- <div class=\"content\">\n- <div class=\"header\">Meta information</div>\n+<div class=\"card\">\n+ <div class=\"card-header\">\n+ Meta information\n</div>\n- <div class=\"content\">\n+ <div class=\"card-body\">\n<form class=\"ui form\">\n- <input type=\"submit\" class=\"ui button primary\" value=\"Save\" form=\"editcontent\">\n+ <input type=\"submit\" class=\"btn btn-primary\" value=\"Save\" form=\"editcontent\">\n{% include '@bolt/editcontent/fields/text.twig' with {\n'label': 'field.id'|trans,\n" }, { "change_type": "MODIFY", "old_path": "templates/editcontent/fields/_base.twig", "new_path": "templates/editcontent/fields/_base.twig", "diff": "{% set label = field.definition.label|default(field.name|ucwords) ~ ':' %}\n{% endif %}\n+{% set prefix = prefix|default(field.prefix|default()) %}\n+{% set postfix = postfix|default(field.postfix|default()) %}\n+\n{% if not name|default() %}\n{% set name = 'fields[' ~ field.name ~ ']' %}\n{% endif %}\n{% if not class|default() %}\n{% set class = field.definition.class|default() %}\n{% endif %}\n+{% set class = \"form-control \" ~ class %}\n{% if not id|default() %}\n{% set id = 'field-' ~ field.name|default(name) %}\n{%- endspaceless -%}\n<!-- field \"{{ label }} {{ name }}\" -->\n-<div class=\"field\">\n+<div class=\"form-group\">\n+{% if prefix %}\n+ <small id=\"{{name}}_prefix\" class=\"form-text text-muted\">{{ prefix }}</small>\n+{% endif %}\n{% block field %}\n+\n{% endblock %}\n+{% if postfix %}\n+ <small id=\"{{name}}_postfix\" class=\"form-text text-muted\">{{ postfix }}</small>\n+{% endif %}\n</div>\n" }, { "change_type": "MODIFY", "old_path": "templates/editcontent/media_edit.twig", "new_path": "templates/editcontent/media_edit.twig", "diff": "<br>\n-<form method=\"post\" class=\"ui form\" id=\"media_edit\">\n+<form method=\"post\" id=\"media_edit\">\n<input type=\"hidden\" name=\"_csrf_token\" value=\"{{ csrf_token('media_edit') }}\">\n{% include '@bolt/editcontent/fields/text.twig' with {\n{% include '@bolt/editcontent/fields/text.twig' with {\n'label': 'field.copyright'|trans,\n'name': 'copyright',\n- 'value': media.copyright\n+ 'value': media.copyright,\n+ 'postfix': \"If the image is copyrighted or licensed, mention the rightsholder here.\"\n} %}\n{% include '@bolt/editcontent/fields/text.twig' with {\n} %}\n- <input type=\"submit\" class=\"ui button primary\" value=\"Save\">\n+ <input type=\"submit\" class=\"btn btn-primary\" value=\"Save\">\n{{ dump(media) }}\n-\n</form>\n{% block aside %}\n-<div class=\"ui card\">\n- <div class=\"content\">\n- <div class=\"header\">Meta information</div>\n- </div>\n- <div class=\"content\">\n+<div class=\"card\">\n+ <div class=\"card-header\">Meta information</div>\n+ <div class=\"card-body\">\n- <form class=\"ui form\">\n+ <form>\n+ <div class=\"form-group\">\n+ <input type=\"submit\" class=\"btn btn-primary\" value=\"Save\" form=\"editcontent\">\n- <input type=\"submit\" class=\"ui button primary\" value=\"Save\" form=\"editcontent\">\n<ul class=\"ui divided selection list\" id=\"swatcheslist\">\n</ul>\n+ </div>\n{% include '@bolt/editcontent/fields/text.twig' with {\n'label': 'field.id'|trans,\n'attributes': 'readonly form=\"editcontent\"',\n} %}\n-\n{#<input type=\"text\" name=\"author\" value=\"{{ media.author }}\">#}\n-\n-\n{% include '@bolt/editcontent/fields/datetime.twig' with {\n'label': 'field.createdAt'|trans,\n'name': 'createdAt',\n" }, { "change_type": "MODIFY", "old_path": "templates/finder/_files.twig", "new_path": "templates/finder/_files.twig", "diff": "-<table class=\"ui celled table\">\n- <thead>\n+<table class=\"table table-striped\" style=\"background-color: #FFF;\">\n+ <thead class=\"thead-light\">\n<tr>\n<th></th>\n<th>Filename</th>\n" }, { "change_type": "MODIFY", "old_path": "templates/finder/_folders.twig", "new_path": "templates/finder/_folders.twig", "diff": "-<table class=\"ui celled table\">\n- <thead>\n+<table class=\"table table-striped\" style=\"background-color: #FFF;\">\n+ <thead class=\"thead-light\">\n<tr>\n<th></th>\n<th>Directoryname</th>\n" }, { "change_type": "MODIFY", "old_path": "templates/finder/_quickselect.twig", "new_path": "templates/finder/_quickselect.twig", "diff": "{% if allfiles %}\n- <div class=\"ui form\">\n- <div class=\"inline fields\">\n+\n+<div class=\"row\">\n+ <div class=\"col-2\">\n<label>Quick select:</label>\n- <div class=\"field\">\n- <div class=\"ui fluid search selection dropdown fileselector\">\n- <input name=\"quickselect\" type=\"hidden\">\n- <i class=\"dropdown icon\"></i>\n- <div class=\"default text\">Quick select a file</div>\n- <div class=\"menu\">\n- {% for file in allfiles %}\n- <div class=\"item\" data-value=\"{{ file.filename }}\">\n- <span class=\"description\">{{ file.description }}</span>\n- <span class=\"text\">{{ file.filename }}</span>\n</div>\n+ <div class=\"col-8\">\n+ <select name=\"quickselect\" id=\"quickselect\">\n+ <option>Quick select a file</option>\n+\n+ {% for file in allfiles %}\n+ <option value=\"{{ file.filename }}\">\n+ {{ file.filename }} - {{ file.description }}\n+ </option>\n{% endfor %}\n+ </select>\n</div>\n+ <div class=\"col-2\">\n+ <button class=\"btn btn-secondary\">Go</button>\n</div>\n</div>\n- <div class=\"field\">\n- <button class=\"ui button primary\">Go</button>\n- </div>\n- </div>\n- </div>\n+\n{% endif %}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "templates/finder/editfile.twig", "new_path": "templates/finder/editfile.twig", "diff": "<textarea name=\"editfile\" id=\"editfile_textarea\">{{ contents }}</textarea>\n</div>\n<div class=\"field\">\n- <button type=\"submit\" class=\"ui button primary\" name=\"save\">Save</button>\n+ <button type=\"submit\" class=\"btn btn-primary\" name=\"save\">Save</button>\n</div>\n</div>\n</form>\n" }, { "change_type": "MODIFY", "old_path": "templates/finder/finder.twig", "new_path": "templates/finder/finder.twig", "diff": "{% endblock aside %}\n+\n+{% block stylesheets %}\n+ {{ parent() }}\n+\n+ <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.6/css/selectize.min.css\" integrity=\"sha256-EhmqrzYSImS7269rfDxk4H+AHDyu/KwV1d8FDgIXScI=\" crossorigin=\"anonymous\" />\n+{% endblock %}\n+\n+\n+{% block javascripts %}\n+ {{ parent() }}\n+ <script src=\"https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.6/js/standalone/selectize.min.js\" integrity=\"sha256-+C0A5Ilqmu4QcSPxrlGpaZxJ04VjsRjKu+G82kl5UJk=\" crossorigin=\"anonymous\"></script>\n+\n+ <script>\n+ document.addEventListener(\"DOMContentLoaded\", function() {\n+ $('#quickselect').selectize({\n+ create: true,\n+ sortField: 'text',\n+ maxItems: null,\n+ closeAfterSelect: true\n+ });\n+ });\n+\n+ document.addEventListener(\"DOMContentLoaded\", function() {\n+ $('#field-status').selectize({\n+ create: true,\n+ sortField: 'text',\n+ maxItems: null,\n+ closeAfterSelect: true\n+ });\n+ });\n+ </script>\n+\n+{% endblock javascripts %}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "templates/users/change_password.twig", "new_path": "templates/users/change_password.twig", "diff": "{{ form_start(form) }}\n{{ form_widget(form) }}\n- <button type=\"submit\" class=\"ui button primary\">\n+ <button type=\"submit\" class=\"btn btn-primary\">\n<i class=\"fa fa-save\" aria-hidden=\"true\"></i> {{ 'action.save'|trans }}\n</button>\n{{ form_end(form) }}\n{% block aside %}\n<div class=\"section\">\n- <a href=\"{{ path('bolt_profile_edit') }}\" class=\"ui button negative\">\n+ <a href=\"{{ path('bolt_profile_edit') }}\" class=\"btn btn-danger\">\n<i class=\"fa fa-edit\" aria-hidden=\"true\"></i> {{ 'action.edit_user'|trans }}\n</a>\n</div>\n" }, { "change_type": "MODIFY", "old_path": "templates/users/edit.twig", "new_path": "templates/users/edit.twig", "diff": "{% form_theme form 'form/semantic-ui-theme.twig' %}\n{{ form_start(form) }}\n{{ form_widget(form) }}\n- <button type=\"submit\" class=\"ui button primary\">\n+ <button type=\"submit\" class=\"btn btn-primary\">\n<i class=\"fa fa-save\" aria-hidden=\"true\"></i> {{ 'action.save'|trans }}\n</button>\n{{ form_end(form) }}\n{% block aside %}\n<div class=\"section\">\n- <a href=\"{{ path('bolt_change_password') }}\" class=\"ui button negative\">\n+ <a href=\"{{ path('bolt_change_password') }}\" class=\"btn btn-danger\">\n<i class=\"fa fa-lock\" aria-hidden=\"true\"></i> {{ 'action.change_password'|trans }}\n</a>\n</div>\n" } ]
PHP
MIT License
bolt/core
Working on replacing Semantic for Bootstrap
95,144
15.10.2018 21:30:29
-7,200
00caceb9b572c09ffb2e048e5b5d4c75508bb30c
More Semantic -> Bootstrap changes
[ { "change_type": "DELETE", "old_path": "assets/js/Components/Hello.vue", "new_path": null, "diff": "-<template>\n- <p>{{ greeting }} World!</p>\n-</template>\n-\n-<script>\n-module.exports = {\n- data: function() {\n- return {\n- greeting: \"Hello\"\n- };\n- }\n-};\n-</script>\n-\n-<style scoped>\n-p {\n- font-size: 2em;\n- text-align: center;\n-}\n-</style>\n" }, { "change_type": "MODIFY", "old_path": "assets/js/Components/Topbar.vue", "new_path": "assets/js/Components/Topbar.vue", "diff": "</button>\n<div class=\"dropdown-menu dropdown-menu-right\" aria-labelledby=\"btnGroupDrop1\">\n<a href=\"/bolt/profile-edit\" class=\"dropdown-item\">Edit profile</a>\n- <a href=\"/logout\" class=\"dropdown-item\">Logout</a>\n+ <a href=\"/bolt/logout\" class=\"dropdown-item\">Logout</a>\n</div>\n</div>\n" }, { "change_type": "MODIFY", "old_path": "assets/js/bolt.js", "new_path": "assets/js/bolt.js", "diff": "@@ -5,7 +5,6 @@ import router from \"./router\";\n// import './registerServiceWorker'\n// Bolt Components\n-import Hello from \"./Components/Hello\";\nimport Sidebar from \"./Components/Sidebar\";\nimport Topbar from \"./Components/Topbar\";\nimport DashboardNews from \"./Components/DashboardNews\";\n@@ -15,7 +14,6 @@ import \"../scss/bolt.scss\";\n// Vue.use(SuiVue);\nVue.component(\"sidebar\", Sidebar);\n-Vue.component(\"hello\", Hello);\nVue.component(\"topbar\", Topbar);\nVue.component(\"dashboardnews\", DashboardNews);\nVue.component(\"app\", App);\n@@ -31,10 +29,6 @@ new Vue({ el: \"#vuecontent\", router });\nnew Vue({ el: \"dashboardnews\" });\n-// Semantic UI Calendar\n-import \"semantic-ui-calendar/dist/calendar.css\";\n-import \"semantic-ui-calendar/dist/calendar\";\n-\n$(document).ready(function() {\n// $(\".ui.dropdown\").dropdown({});\n" }, { "change_type": "MODIFY", "old_path": "assets/scss/_semantic-overrides.scss", "new_path": "assets/scss/_semantic-overrides.scss", "diff": "padding: 11px 16px;\n}\n-.ui.form input[readonly] {\n- background-color: #F5F5F5;\n- color: #999;\n+input[readonly] {\n+ background-color: #F2F2F2;\n+ color: #888;\n}\n-.ui.fileselector {\n- min-width: 500px !important;\n-}\n-\n-.ui.button {\n+.input-group-append .btn {\nfont-weight: normal;\nfont-size: 0.9rem;\n- color: #555;\n-\n- a {\n- color: #555;\n- }\n-\n- &.small {\n- padding: 0.6rem 0.8rem;\n- }\n-\n- &.has-dropdown {\n- padding-right: 0.4rem;\n- }\n-\n- &.small + &.dropdown {\n- padding-left: 0.4rem;\n- }\n-}\n-\n-.ui.dropdown .menu > .item {\n- font-size: 0.9rem;\n- padding: 0.5rem 1rem !important;\n-\n-}\n-\n-.ui.form .field > label {\n- font-weight: 500;\n- font-size: 1rem;\n- color: #444;\n-}\n-\n-label {\n- font-weight: 500;\n- line-height: 2rem;\n}\n-.ui.form .field .ui.grid {\n- margin-top: 0;\n-}\n-\n-.ui.grid > [class*=\"twelve wide\"].column {\n- min-width: 250px;\n-}\n-\n-aside {\n- .column {\n- padding: 0 1rem 0.5rem !important;\n- }\n-}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "composer.lock", "new_path": "composer.lock", "diff": "},\n{\n\"name\": \"league/flysystem\",\n- \"version\": \"1.0.47\",\n+ \"version\": \"1.0.48\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/thephpleague/flysystem.git\",\n- \"reference\": \"a11e4a75f256bdacf99d20780ce42d3b8272975c\"\n+ \"reference\": \"a6ded5b2f6055e2db97b4b859fdfca2b952b78aa\"\n},\n\"dist\": {\n\"type\": \"zip\",\n- \"url\": \"https://api.github.com/repos/thephpleague/flysystem/zipball/a11e4a75f256bdacf99d20780ce42d3b8272975c\",\n- \"reference\": \"a11e4a75f256bdacf99d20780ce42d3b8272975c\",\n+ \"url\": \"https://api.github.com/repos/thephpleague/flysystem/zipball/a6ded5b2f6055e2db97b4b859fdfca2b952b78aa\",\n+ \"reference\": \"a6ded5b2f6055e2db97b4b859fdfca2b952b78aa\",\n\"shasum\": \"\"\n},\n\"require\": {\n\"sftp\",\n\"storage\"\n],\n- \"time\": \"2018-09-14T15:30:29+00:00\"\n+ \"time\": \"2018-10-15T13:53:10+00:00\"\n},\n{\n\"name\": \"league/glide\",\n},\n{\n\"name\": \"symfony/maker-bundle\",\n- \"version\": \"v1.7.0\",\n+ \"version\": \"v1.8.0\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/symfony/maker-bundle.git\",\n- \"reference\": \"22a9bf33868f0fed6cab013fe5231e8485d15e20\"\n+ \"reference\": \"26643943fe19b5b47d620744907f09d1d6b3f06f\"\n},\n\"dist\": {\n\"type\": \"zip\",\n- \"url\": \"https://api.github.com/repos/symfony/maker-bundle/zipball/22a9bf33868f0fed6cab013fe5231e8485d15e20\",\n- \"reference\": \"22a9bf33868f0fed6cab013fe5231e8485d15e20\",\n+ \"url\": \"https://api.github.com/repos/symfony/maker-bundle/zipball/26643943fe19b5b47d620744907f09d1d6b3f06f\",\n+ \"reference\": \"26643943fe19b5b47d620744907f09d1d6b3f06f\",\n\"shasum\": \"\"\n},\n\"require\": {\n\"scaffold\",\n\"scaffolding\"\n],\n- \"time\": \"2018-08-30T01:08:06+00:00\"\n+ \"time\": \"2018-10-13T19:56:32+00:00\"\n},\n{\n\"name\": \"symfony/phpunit-bridge\",\n" }, { "change_type": "MODIFY", "old_path": "package-lock.json", "new_path": "package-lock.json", "diff": "{\n- \"requires\": true,\n+ \"name\": \"bolt\",\n+ \"version\": \"4.0.0-alpha.0\",\n\"lockfileVersion\": 1,\n+ \"requires\": true,\n\"dependencies\": {\n\"@babel/code-frame\": {\n\"version\": \"7.0.0\",\n}\n},\n\"eslint\": {\n- \"version\": \"5.6.1\",\n- \"resolved\": \"https://registry.npmjs.org/eslint/-/eslint-5.6.1.tgz\",\n- \"integrity\": \"sha512-hgrDtGWz368b7Wqf+v1Z69O3ZebNR0+GA7PtDdbmuz4rInFVUV9uw7whjZEiWyLzCjVb5Rs5WRN1TAS6eo7AYA==\",\n+ \"version\": \"5.7.0\",\n+ \"resolved\": \"https://registry.npmjs.org/eslint/-/eslint-5.7.0.tgz\",\n+ \"integrity\": \"sha512-zYCeFQahsxffGl87U2aJ7DPyH8CbWgxBC213Y8+TCanhUTf2gEvfq3EKpHmEcozTLyPmGe9LZdMAwC/CpJBM5A==\",\n\"dev\": true,\n\"requires\": {\n\"@babel/code-frame\": \"^7.0.0\",\n\"path-is-inside\": \"^1.0.2\",\n\"pluralize\": \"^7.0.0\",\n\"progress\": \"^2.0.0\",\n- \"regexpp\": \"^2.0.0\",\n+ \"regexpp\": \"^2.0.1\",\n\"require-uncached\": \"^1.0.3\",\n\"semver\": \"^5.5.1\",\n\"strip-ansi\": \"^4.0.0\",\n\"strip-json-comments\": \"^2.0.1\",\n- \"table\": \"^4.0.3\",\n+ \"table\": \"^5.0.2\",\n\"text-table\": \"^0.2.0\"\n},\n\"dependencies\": {\n\"dev\": true\n},\n\"har-validator\": {\n- \"version\": \"5.0.3\",\n- \"resolved\": \"https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz\",\n- \"integrity\": \"sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=\",\n+ \"version\": \"5.1.0\",\n+ \"resolved\": \"https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz\",\n+ \"integrity\": \"sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==\",\n\"dev\": true,\n\"requires\": {\n- \"ajv\": \"^5.1.0\",\n+ \"ajv\": \"^5.3.0\",\n\"har-schema\": \"^2.0.0\"\n}\n},\n}\n},\n\"node-sass\": {\n- \"version\": \"4.9.3\",\n- \"resolved\": \"https://registry.npmjs.org/node-sass/-/node-sass-4.9.3.tgz\",\n- \"integrity\": \"sha512-XzXyGjO+84wxyH7fV6IwBOTrEBe2f0a6SBze9QWWYR/cL74AcQUks2AsqcCZenl/Fp/JVbuEaLpgrLtocwBUww==\",\n+ \"version\": \"4.9.4\",\n+ \"resolved\": \"https://registry.npmjs.org/node-sass/-/node-sass-4.9.4.tgz\",\n+ \"integrity\": \"sha512-MXyurANsUoE4/6KmfMkwGcBzAnJQ5xJBGW7Ei6ea8KnUKuzHr/SguVBIi3uaUAHtZCPUYkvlJ3Ef5T5VAwVpaA==\",\n\"dev\": true,\n\"requires\": {\n\"async-foreach\": \"^0.1.3\",\n\"nan\": \"^2.10.0\",\n\"node-gyp\": \"^3.8.0\",\n\"npmlog\": \"^4.0.0\",\n- \"request\": \"2.87.0\",\n+ \"request\": \"^2.88.0\",\n\"sass-graph\": \"^2.2.4\",\n\"stdout-stream\": \"^1.4.0\",\n\"true-case-path\": \"^1.0.2\"\n\"dev\": true\n},\n\"oauth-sign\": {\n- \"version\": \"0.8.2\",\n- \"resolved\": \"https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz\",\n- \"integrity\": \"sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=\",\n+ \"version\": \"0.9.0\",\n+ \"resolved\": \"https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz\",\n+ \"integrity\": \"sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==\",\n\"dev\": true\n},\n\"object-assign\": {\n\"integrity\": \"sha1-8FKijacOYYkX7wqKw0wa5aaChrM=\",\n\"dev\": true\n},\n+ \"psl\": {\n+ \"version\": \"1.1.29\",\n+ \"resolved\": \"https://registry.npmjs.org/psl/-/psl-1.1.29.tgz\",\n+ \"integrity\": \"sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==\",\n+ \"dev\": true\n+ },\n\"public-encrypt\": {\n\"version\": \"4.0.3\",\n\"resolved\": \"https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz\",\n}\n},\n\"request\": {\n- \"version\": \"2.87.0\",\n- \"resolved\": \"https://registry.npmjs.org/request/-/request-2.87.0.tgz\",\n- \"integrity\": \"sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==\",\n+ \"version\": \"2.88.0\",\n+ \"resolved\": \"https://registry.npmjs.org/request/-/request-2.88.0.tgz\",\n+ \"integrity\": \"sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==\",\n\"dev\": true,\n\"requires\": {\n\"aws-sign2\": \"~0.7.0\",\n- \"aws4\": \"^1.6.0\",\n+ \"aws4\": \"^1.8.0\",\n\"caseless\": \"~0.12.0\",\n- \"combined-stream\": \"~1.0.5\",\n- \"extend\": \"~3.0.1\",\n+ \"combined-stream\": \"~1.0.6\",\n+ \"extend\": \"~3.0.2\",\n\"forever-agent\": \"~0.6.1\",\n- \"form-data\": \"~2.3.1\",\n- \"har-validator\": \"~5.0.3\",\n+ \"form-data\": \"~2.3.2\",\n+ \"har-validator\": \"~5.1.0\",\n\"http-signature\": \"~1.2.0\",\n\"is-typedarray\": \"~1.0.0\",\n\"isstream\": \"~0.1.2\",\n\"json-stringify-safe\": \"~5.0.1\",\n- \"mime-types\": \"~2.1.17\",\n- \"oauth-sign\": \"~0.8.2\",\n+ \"mime-types\": \"~2.1.19\",\n+ \"oauth-sign\": \"~0.9.0\",\n\"performance-now\": \"^2.1.0\",\n- \"qs\": \"~6.5.1\",\n- \"safe-buffer\": \"^5.1.1\",\n- \"tough-cookie\": \"~2.3.3\",\n+ \"qs\": \"~6.5.2\",\n+ \"safe-buffer\": \"^5.1.2\",\n+ \"tough-cookie\": \"~2.4.3\",\n\"tunnel-agent\": \"^0.6.0\",\n- \"uuid\": \"^3.1.0\"\n+ \"uuid\": \"^3.3.2\"\n}\n},\n\"require-directory\": {\n\"node-forge\": \"0.7.5\"\n}\n},\n- \"semantic-ui-calendar\": {\n- \"version\": \"0.0.8\",\n- \"resolved\": \"https://registry.npmjs.org/semantic-ui-calendar/-/semantic-ui-calendar-0.0.8.tgz\",\n- \"integrity\": \"sha1-rhZQTk2AFsrFupoArYzNSkMN4+8=\"\n- },\n\"semver\": {\n\"version\": \"5.6.0\",\n\"resolved\": \"https://registry.npmjs.org/semver/-/semver-5.6.0.tgz\",\n}\n},\n\"table\": {\n- \"version\": \"4.0.3\",\n- \"resolved\": \"http://registry.npmjs.org/table/-/table-4.0.3.tgz\",\n- \"integrity\": \"sha512-S7rnFITmBH1EnyKcvxBh1LjYeQMmnZtCXSEbHcH6S0NoKit24ZuFO/T1vDcLdYsLQkM188PVVhQmzKIuThNkKg==\",\n+ \"version\": \"5.1.0\",\n+ \"resolved\": \"https://registry.npmjs.org/table/-/table-5.1.0.tgz\",\n+ \"integrity\": \"sha512-e542in22ZLhD/fOIuXs/8yDZ9W61ltF8daM88rkRNtgTIct+vI2fTnAyu/Db2TCfEcI8i7mjZz6meLq0nW7TYg==\",\n\"dev\": true,\n\"requires\": {\n- \"ajv\": \"^6.0.1\",\n- \"ajv-keywords\": \"^3.0.0\",\n- \"chalk\": \"^2.1.0\",\n- \"lodash\": \"^4.17.4\",\n+ \"ajv\": \"^6.5.3\",\n+ \"lodash\": \"^4.17.10\",\n\"slice-ansi\": \"1.0.0\",\n\"string-width\": \"^2.1.1\"\n},\n\"uri-js\": \"^4.2.2\"\n}\n},\n- \"ansi-styles\": {\n- \"version\": \"3.2.1\",\n- \"resolved\": \"https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz\",\n- \"integrity\": \"sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==\",\n- \"dev\": true,\n- \"requires\": {\n- \"color-convert\": \"^1.9.0\"\n- }\n- },\n- \"chalk\": {\n- \"version\": \"2.4.1\",\n- \"resolved\": \"https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz\",\n- \"integrity\": \"sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==\",\n- \"dev\": true,\n- \"requires\": {\n- \"ansi-styles\": \"^3.2.1\",\n- \"escape-string-regexp\": \"^1.0.5\",\n- \"supports-color\": \"^5.3.0\"\n- }\n- },\n\"fast-deep-equal\": {\n\"version\": \"2.0.1\",\n\"resolved\": \"https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz\",\n\"integrity\": \"sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=\",\n\"dev\": true\n},\n- \"has-flag\": {\n- \"version\": \"3.0.0\",\n- \"resolved\": \"https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz\",\n- \"integrity\": \"sha1-tdRU3CGZriJWmfNGfloH87lVuv0=\",\n- \"dev\": true\n- },\n\"json-schema-traverse\": {\n\"version\": \"0.4.1\",\n\"resolved\": \"https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz\",\n\"integrity\": \"sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==\",\n\"dev\": true\n- },\n- \"supports-color\": {\n- \"version\": \"5.5.0\",\n- \"resolved\": \"https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz\",\n- \"integrity\": \"sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==\",\n- \"dev\": true,\n- \"requires\": {\n- \"has-flag\": \"^3.0.0\"\n- }\n}\n}\n},\n}\n},\n\"tough-cookie\": {\n- \"version\": \"2.3.4\",\n- \"resolved\": \"https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz\",\n- \"integrity\": \"sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==\",\n+ \"version\": \"2.4.3\",\n+ \"resolved\": \"https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz\",\n+ \"integrity\": \"sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==\",\n\"dev\": true,\n\"requires\": {\n+ \"psl\": \"^1.1.24\",\n\"punycode\": \"^1.4.1\"\n},\n\"dependencies\": {\n" }, { "change_type": "MODIFY", "old_path": "package.json", "new_path": "package.json", "diff": "{\n- \"eslintConfig\": {\n- \"root\": true,\n- \"extends\": [\n- \"plugin:vue/essential\",\n- \"plugin:prettier/recommended\",\n- \"eslint:recommended\"\n- ]\n+ \"name\": \"bolt\",\n+ \"version\": \"4.0.0-alpha.0\",\n+ \"homepage\": \"https://bolt.cm\",\n+ \"author\": \"Bob den Otter <bob@twokings.nl> (https://bolt.cm)\",\n+ \"license\": \"MIT\",\n+ \"repository\": {\n+ \"type\": \"git\",\n+ \"url\": \"git://github.com/bobdenotter/symfony-skeleton.git\"\n},\n\"devDependencies\": {\n\"@symfony/webpack-encore\": \"^0.20.1\",\n- \"eslint\": \"5.6.1\",\n+ \"eslint\": \"5.7.0\",\n\"eslint-config-prettier\": \"3.1.0\",\n\"eslint-plugin-prettier\": \"3.0.0\",\n\"eslint-plugin-vue\": \"4.7.1\",\n\"jquery\": \"^3.3.1\",\n- \"node-sass\": \"^4.9.3\",\n+ \"node-sass\": \"^4.9.4\",\n\"register-service-worker\": \"^1.5.2\",\n\"sass-loader\": \"^7.1.0\",\n\"vue-loader\": \"^14\",\n\"dependencies\": {\n\"axios\": \"^0.18.0\",\n\"codemirror\": \"^5.40.2\",\n- \"semantic-ui-calendar\": \"^0.0.8\",\n\"simplemde\": \"^1.11.2\",\n\"vue\": \"^2.5.17\"\n},\n\"scripts\": {\n\"lint\": \"eslint --ext .js,.vue assets\",\n- \"dev-server\": \"./node_modules/.bin/encore dev-server\",\n- \"dev\": \"./node_modules/.bin/encore dev\",\n- \"watch\": \"./node_modules/.bin/encore dev --watch\",\n- \"build\": \"./node_modules/.bin/encore production\"\n- }\n+ \"dev-server\": \"encore dev-server\",\n+ \"dev\": \"encore dev\",\n+ \"watch\": \"encore dev --watch\",\n+ \"build\": \"encore production\"\n+ },\n+ \"eslintConfig\": {\n+ \"root\": true,\n+ \"extends\": [\n+ \"plugin:vue/essential\",\n+ \"plugin:prettier/recommended\",\n+ \"eslint:recommended\"\n+ ]\n+ },\n+ \"description\": \"Bolt 4.0.0 prototype\",\n+ \"bugs\": {\n+ \"url\": \"https://github.com/bobdenotter/symfony-skeleton/issues\"\n+ },\n+ \"main\": \"webpack.config.js\",\n+ \"directories\": {\n+ \"test\": \"tests\"\n+ },\n+ \"keywords\": [\n+ \"bolt\",\n+ \"cms\",\n+ \"php\",\n+ \"symfony\",\n+ \"vue\",\n+ \"content\",\n+ \"management\",\n+ \"system\"\n+ ]\n}\n" }, { "change_type": "MODIFY", "old_path": "templates/_base/layout.twig", "new_path": "templates/_base/layout.twig", "diff": "<script src=\"{{ asset('assets/bolt.js') }}\"></script>\n<script src=\"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js\" integrity=\"sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49\" crossorigin=\"anonymous\"></script>\n<script src=\"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js\" integrity=\"sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy\" crossorigin=\"anonymous\"></script>\n-\n{% endblock %}\n</body>\n" }, { "change_type": "MODIFY", "old_path": "templates/_base/layout_blank.twig", "new_path": "templates/_base/layout_blank.twig", "diff": "{% block stylesheets %}\n<link href=\"https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700\" rel=\"stylesheet\">\n<link rel=\"stylesheet\" href=\"https://use.fontawesome.com/releases/v5.3.1/css/all.css\" integrity=\"sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU\" crossorigin=\"anonymous\">\n- <link rel=\"stylesheet\" type=\"text/css\" href=\"https://cdn.jsdelivr.net/npm/semantic-ui@2.4.0/dist/semantic.min.css\">\n+ <link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css\" integrity=\"sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO\" crossorigin=\"anonymous\">\n<link rel=\"stylesheet\" type=\"text/css\" href=\"{{ asset('assets/bolt.css') }}\">\n{% endblock %}\n</head>\n{% block javascripts %}\n<script src=\"{{ asset('assets/bolt.js') }}\"></script>\n- <script src=\"https://cdn.jsdelivr.net/npm/semantic-ui@2.4.0/dist/semantic.min.js\"></script>\n+ <script src=\"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js\" integrity=\"sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49\" crossorigin=\"anonymous\"></script>\n+ <script src=\"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js\" integrity=\"sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy\" crossorigin=\"anonymous\"></script>\n{% endblock %}\n</body>\n" }, { "change_type": "MODIFY", "old_path": "templates/_partials/_flash_messages.twig", "new_path": "templates/_partials/_flash_messages.twig", "diff": "{% for type, messages in app.flashes %}\n{% for message in messages %}\n- <div class=\"ui {{ type }} message\">\n- <p>{{ message|trans }}</p>\n+ <div class=\"alert alert-{{ type }} alert-dismissible fade show\" role=\"alert\">\n+ {{ message|trans }}\n+ <button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\">\n+ <span aria-hidden=\"true\">&times;</span>\n+ </button>\n</div>\n{% endfor %}\n{% endfor %}\n" }, { "change_type": "MODIFY", "old_path": "templates/_partials/_pager.twig", "new_path": "templates/_partials/_pager.twig", "diff": "{% if records.haveToPaginate|default() %}\n<div class=\"navigation text-center\">\n- {{ pagerfanta(records, 'semantic_ui_translated', {\n+ {{ pagerfanta(records, 'twitter_bootstrap4_translated', {\nrouteName: 'bolt_contentlisting',\nrouteParams: { 'contenttype': contenttype.slug|default() }\n}) }}\n" }, { "change_type": "DELETE", "old_path": "templates/form/semantic-ui-theme.twig", "new_path": null, "diff": "-{% use 'form_div_layout.html.twig' %}\n-\n-{% block form_start -%}\n- {% set attr = attr|merge({class: (attr.class|default('') ~ ' ui form')|trim}) %}\n- {{- parent() -}}\n-{%- endblock form_start %}\n-\n-{# Widgets #}\n-\n-{% block form_widget_simple -%}\n- {{- parent() -}}\n-{%- endblock form_widget_simple %}\n-\n-{% block textarea_widget -%}\n- {% set attr = attr|merge({class: (attr.class|default('') ~ ' form-control')|trim}) %}\n- {{- parent() -}}\n-{%- endblock textarea_widget %}\n-\n-{% block button_widget -%}\n- {% set attr = attr|merge({class: (attr.class|default('') ~ ' ui button')|trim}) %}\n- {{- parent() -}}\n-{%- endblock %}\n-\n-{% block money_widget -%}\n- {{- block('form_widget_simple') -}}\n-{%- endblock money_widget %}\n-\n-{% block percent_widget -%}\n- {{- block('form_widget_simple') -}}\n-{%- endblock percent_widget %}\n-\n-{% block datetime_widget -%}\n- {{- block('form_widget_simple') -}}\n-{%- endblock datetime_widget %}\n-\n-{% block date_widget -%}\n- {{- block('form_widget_simple') -}}\n-{%- endblock date_widget %}\n-\n-{% block time_widget -%}\n- {{- block('form_widget_simple') -}}\n-{%- endblock time_widget %}\n-\n-{% block dateinterval_widget %}\n- {{- block('form_widget_simple') -}}\n-{% endblock dateinterval_widget %}\n-\n-{% block checkbox_widget -%}\n- <div class=\"ui toggle checkbox\">\n- {% set attr = attr|merge({class: (attr.class|default('') ~ ' hidden')|trim}) %}\n- {{- form_label(form, null, { widget: parent() }) -}}\n- </div>\n-{%- endblock checkbox_widget %}\n-\n-{% block radio_widget -%}\n- <div class=\"ui radio checkbox\">\n- {% set attr = attr|merge({class: (attr.class|default('') ~ ' hidden')|trim}) %}\n- {{- form_label(form, null, { widget: parent() }) -}}\n- </div>\n-{%- endblock radio_widget %}\n-\n-{# Labels #}\n-\n-{% block form_label -%}\n- {{- parent() -}}\n-{%- endblock form_label %}\n-\n-{% block choice_label -%}\n- {{- block('form_label') -}}\n-{% endblock %}\n-\n-{% block checkbox_label -%}\n- {{- block('checkbox_radio_label') -}}\n-{%- endblock checkbox_label %}\n-\n-{% block radio_label -%}\n- {{- block('checkbox_radio_label') -}}\n-{%- endblock radio_label %}\n-\n-{% block checkbox_radio_label %}\n- {# Do not display the label if widget is not defined in order to prevent double label rendering #}\n- {% if widget is defined %}\n- {% if required %}\n- {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) %}\n- {% endif %}\n- {% if label is not same as(false) and label is empty %}\n- {%- if label_format is not empty -%}\n- {% set label = label_format|replace({\n- '%name%': name,\n- '%id%': id,\n- }) %}\n- {%- else -%}\n- {% set label = name|humanize %}\n- {%- endif -%}\n- {% endif %}\n- <label{% for attrname, attrvalue in label_attr %} {{ attrname }}=\"{{ attrvalue }}\"{% endfor %}>\n- {{- widget|raw }} {{ label is not same as(false) ? (translation_domain is same as(false) ? label : label|trans({}, translation_domain)) -}}\n- </label>\n- {% endif %}\n-{% endblock checkbox_radio_label %}\n-\n-{# Rows #}\n-\n-{% block form_row -%}\n- <div class=\"field{% if not valid %} error{% endif %}\">\n- {{- form_label(form) -}}\n- {{- form_widget(form) -}}\n- {{- form_errors(form) -}}\n- </div>\n-{%- endblock form_row %}\n-\n-{% block button_row -%}\n- {{- form_widget(form) -}}\n-{%- endblock button_row %}\n-\n-{% block choice_row -%}\n- {{- block('form_row') }}\n-{%- endblock choice_row %}\n-\n-{% block date_row -%}\n- {{- block('form_row') }}\n-{%- endblock date_row %}\n-\n-{% block time_row -%}\n- {{- block('form_row') }}\n-{%- endblock time_row %}\n-\n-{% block datetime_row -%}\n- {{- block('form_row') }}\n-{%- endblock datetime_row %}\n-\n-{% block checkbox_row -%}\n- <div class=\"field{% if not valid %} error{% endif %}\">\n- {{- form_widget(form) -}}\n- {{- form_errors(form) -}}\n- </div>\n-{%- endblock checkbox_row %}\n-\n-{% block radio_row -%}\n- <div class=\"field{% if not valid %} error{% endif %}\">\n- {{- form_widget(form) -}}\n- {{- form_errors(form) -}}\n- </div>\n-{%- endblock radio_row %}\n-\n-{# Errors #}\n-\n-{% block form_errors -%}\n- {% if errors|length > 0 -%}\n- <div class=\"ui pointing red label\">\n- <i class=\"warning sign icon\"></i>\n- {%- for error in errors -%}\n- {{ error.message }}\n- {%- endfor -%}\n- </div>\n- {%- endif %}\n-{%- endblock form_errors %}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "templates/security/login.twig", "new_path": "templates/security/login.twig", "diff": "body {\nbackground: transparent;\n+ display: flex;\n+ justify-content: center;\n+ align-items: center;\n}\n- body > .grid {\n- height: 100%;\n- }\n-\n- .image {\n- margin-top: -100px;\n- }\n-\n- .column {\n- max-width: 382px;\n- }\n-\n- .field, .message {\n- text-align: left;\n- }\n-\n- .ui.raised.card {\n- width: 360px;\n- }\n-\n- fieldset {\n- border: 0;\n- margin: 0;\n- padding: 0;\n+ .card {\n+ width: 22rem;\n+ box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.4);\n}\n</style>\n{% block javascripts %}\n{{ parent() }}\n- {#<script src=\"{{ asset('build/js/login.js') }}\"></script>#}\n-\n-\n-\n{% endblock %}\n{% block main %}\n+<div class=\"card\">\n-<div class=\"ui middle aligned center aligned grid\">\n- <div class=\"column\">\n- <form action=\"{{ path('bolt_login') }}\" method=\"post\" class=\"ui form\">\n- <input type=\"hidden\" name=\"_target_path\" value=\"{{ app.request.get('redirect_to') }}\" />\n- <input type=\"hidden\" name=\"_csrf_token\" value=\"{{ csrf_token('authenticate') }}\" />\n+ <div class=\"card-header\">\n- <fieldset>\n- <div class=\"ui card raised\">\n- <div class=\"content\">\n- <div class=\"header\"><i class=\"fa fa-lock\" aria-hidden=\"true\"></i> Bolt &raquo; Login </div>\n+ <i class=\"fa fa-lock\" aria-hidden=\"true\"></i>\n+ Bolt &raquo; Login\n</div>\n- <div class=\"content\">\n+\n+ <div class=\"card-body\">\n+\n{% if error %}\n- <div class=\"ui negative message\">\n+ <div class=\"alert alert-danger\">\n<i class=\"fas fa-exclamation-circle\"></i>\n{{ error.messageKey|trans(error.messageData, 'security') }}\n</div>\n{% endif %}\n- <div class=\"field\">\n- <label for=\"username\">{{ 'label.username'|trans }}</label>\n- <input type=\"text\" placeholder=\"{{ 'label.username'|trans }}\" id=\"username\" name=\"username\"\n- value=\"{{ last_username }}\" class=\"form-control\" />\n+\n+ <form action=\"{{ path('bolt_login') }}\" method=\"post\" class=\"\">\n+ <input type=\"hidden\" name=\"_target_path\" value=\"{{ app.request.get('redirect_to') }}\"/>\n+ <input type=\"hidden\" name=\"_csrf_token\" value=\"{{ csrf_token('authenticate') }}\"/>\n+\n+ <div class=\"form-group\">\n+ <label for=\"username\">{{ 'label.username_or_email'|trans }}</label>\n+ <div class=\"input-group mb-3\">\n+ <div class=\"input-group-prepend\">\n+ <span class=\"input-group-text\"><i class=\"fas fa-user\"></i></span>\n+ </div>\n+ <input type=\"text\" placeholder=\"{{ 'label.username'|trans }}\" id=\"username\" name=\"username\" value=\"{{ last_username }}\" class=\"form-control\"/>\n</div>\n- <div class=\"field\">\n+ </div>\n+ <div class=\"form-group\">\n<label for=\"password\">{{ 'label.password'|trans }}</label>\n- <input type=\"password\" placeholder=\"{{ 'label.password'|trans }}\" id=\"password\" name=\"password\"\n- class=\"form-control\" />\n+ <div class=\"input-group mb-3\">\n+ <div class=\"input-group-prepend\">\n+ <span class=\"input-group-text\"><i class=\"fas fa-key\"></i></span>\n</div>\n- <div class=\"field\">\n- <div class=\"ui checkbox\">\n- <input type=\"checkbox\" name=\"_remember_me\" id=\"_remember_me\">\n- <label for=\"_remember_me\">Remember me</label>\n+ <input type=\"password\" placeholder=\"{{ 'label.password'|trans }}\" id=\"password\" name=\"password\" class=\"form-control\"/>\n</div>\n</div>\n+ <div class=\"form-group form-check\">\n+ <input type=\"checkbox\" class=\"form-check-input\" name=\"_remember_me\" id=\"_remember_me\">\n+ <label class=\"form-check-label\" for=\"_remember_me\">{{ 'label.rememberme'|trans }}</label>\n</div>\n- <div class=\"extra content\">\n- <button type=\"submit\" class=\"ui button primary\">\n- <i class=\"fas fa-sign-in-alt\" aria-hidden=\"true\"></i> {{ 'action.log_in'|trans }}\n+ <button type=\"submit\" class=\"btn btn-primary\">\n+ <i class=\"fas fa-sign-in-alt\" aria-hidden=\"true\"></i>\n+ {{ 'action.log_in'|trans }}\n</button>\n</div>\n- </div>\n- </fieldset>\n</form>\n</div>\n-</div>\n{% endblock %}\n" }, { "change_type": "MODIFY", "old_path": "templates/users/change_password.twig", "new_path": "templates/users/change_password.twig", "diff": "{% block main %}\n- {% form_theme form 'form/semantic-ui-theme.twig' %}\n+ {% form_theme form 'bootstrap_4_layout.html.twig' %}\n- <div class=\"ui warning message\">\n- <p>{{ 'info.change_password'|trans }}</p>\n+ <div class=\"alert alert-warning\">\n+ {{ 'info.change_password'|trans }}\n</div>\n{{ form_start(form) }}\n" }, { "change_type": "MODIFY", "old_path": "templates/users/edit.twig", "new_path": "templates/users/edit.twig", "diff": "{% block main %}\n- {% form_theme form 'form/semantic-ui-theme.twig' %}\n+ {% form_theme form 'bootstrap_4_layout.html.twig' %}\n{{ form_start(form) }}\n{{ form_widget(form) }}\n<button type=\"submit\" class=\"btn btn-primary\">\n" } ]
PHP
MIT License
bolt/core
More Semantic -> Bootstrap changes
95,144
16.10.2018 07:57:46
-7,200
826b334fd7627a2f14741de2f9c720b3836b490c
Working on adding taxonomies
[ { "change_type": "MODIFY", "old_path": "src/Configuration/Config.php", "new_path": "src/Configuration/Config.php", "diff": "@@ -71,7 +71,7 @@ class Config\n$this->data = $config;\n$config['contenttypes'] = $this->parseContentTypes();\n- // 'taxonomy' => $this->parseTaxonomy(),\n+ $config['taxonomies'] = $this->parseTaxonomy();\n// 'menu' => $this->parseConfigYaml('menu.yml'),\n//'routing' => $this->parseConfigYaml('routing.yml'),\n@@ -149,6 +149,74 @@ class Config\nreturn collect($general);\n}\n+\n+\n+ /**\n+ * Read and parse the taxonomy.yml configuration file.\n+ *\n+ * @param array|null $taxonomies\n+ *\n+ * @return array\n+ */\n+ protected function parseTaxonomy()\n+ {\n+ $taxonomies = $this->parseConfigYaml('taxonomy.yml');\n+\n+ $slugify = Slugify::create();\n+\n+ foreach ($taxonomies as $key => $taxonomy) {\n+ if (!isset($taxonomy['name'])) {\n+ $taxonomy['name'] = ucwords(str_replace('-', ' ', Str::humanize($taxonomy['slug'])));\n+ }\n+ if (!isset($taxonomy['singular_name'])) {\n+ if (isset($taxonomy['singular_slug'])) {\n+ $taxonomy['singular_name'] = ucwords(str_replace('-', ' ', Str::humanize($taxonomy['singular_slug'])));\n+ } else {\n+ $taxonomy['singular_name'] = ucwords(str_replace('-', ' ', Str::humanize($taxonomy['slug'])));\n+ }\n+ }\n+ if (!isset($taxonomy['slug'])) {\n+ $taxonomy['slug'] = $slugify->slugify($taxonomy['name']);\n+ }\n+ if (!isset($taxonomy['singular_slug'])) {\n+ $taxonomy['singular_slug'] = $slugify->slugify($taxonomy['singular_name']);\n+ }\n+ if (!isset($taxonomy['has_sortorder'])) {\n+ $taxonomy['has_sortorder'] = false;\n+ }\n+ if (!isset($taxonomy['allow_spaces'])) {\n+ $taxonomy['allow_spaces'] = false;\n+ }\n+\n+ // Make sure the options are $key => $value pairs, and not have implied integers for keys.\n+ if (!empty($taxonomy['options']) && is_array($taxonomy['options'])) {\n+ $options = [];\n+ foreach ($taxonomy['options'] as $optionKey => $optionValue) {\n+ if (is_numeric($optionKey)) {\n+ $optionKey = $optionValue;\n+ }\n+ $optionKey = $slugify->slugify($optionKey);\n+ $options[$optionKey] = $optionValue;\n+ }\n+ $taxonomy['options'] = $options;\n+ }\n+\n+ if (!isset($taxonomy['behaves_like'])) {\n+ $taxonomy['behaves_like'] = 'tags';\n+ }\n+ // If taxonomy is like tags, set 'tagcloud' to true by default.\n+ if (($taxonomy['behaves_like'] === 'tags') && (!isset($taxonomy['tagcloud']))) {\n+ $taxonomy['tagcloud'] = true;\n+ } else {\n+ $taxonomy += ['tagcloud' => false];\n+ }\n+\n+ $taxonomies[$key] = $taxonomy;\n+ }\n+\n+ return $taxonomies;\n+ }\n+\n/**\n* Read and parse the contenttypes.yml configuration file.\n*\n" }, { "change_type": "MODIFY", "old_path": "src/Content/MediaFactory.php", "new_path": "src/Content/MediaFactory.php", "diff": "@@ -63,7 +63,7 @@ class MediaFactory\n->setCreatedAt(Carbon::createFromTimestamp($file->getCTime()))\n->setFilesize($file->getSize())\n->setTitle($this->faker->sentence(6, true))\n- ->addAuthor($this->getUser());\n+ ->setAuthor($this->getUser());\nif ($this->isImage($media)) {\n$this->updateImageData($media, $file);\n" }, { "change_type": "MODIFY", "old_path": "src/DataFixtures/ContentFixtures.php", "new_path": "src/DataFixtures/ContentFixtures.php", "diff": "@@ -7,17 +7,13 @@ namespace Bolt\\DataFixtures;\nuse Bolt\\Configuration\\Config;\nuse Bolt\\Content\\FieldFactory;\nuse Bolt\\Entity\\Content;\n-use Bolt\\Entity\\User;\nuse Doctrine\\Bundle\\FixturesBundle\\Fixture;\n+use Doctrine\\Common\\DataFixtures\\DependentFixtureInterface;\nuse Doctrine\\Common\\Persistence\\ObjectManager;\nuse Faker\\Factory;\n-use Symfony\\Component\\Security\\Core\\Encoder\\UserPasswordEncoderInterface;\n-class ContentFixtures extends Fixture\n+class ContentFixtures extends Fixture implements DependentFixtureInterface\n{\n- /** @var UserPasswordEncoderInterface */\n- private $passwordEncoder;\n-\n/** @var \\Faker\\Generator */\nprivate $faker;\n@@ -26,50 +22,27 @@ class ContentFixtures extends Fixture\nprivate $lastTitle = null;\n- public function __construct(UserPasswordEncoderInterface $passwordEncoder, Config $config)\n+ public function __construct(Config $config)\n{\n- $this->passwordEncoder = $passwordEncoder;\n$this->faker = Factory::create();\n$this->config = $config->get('contenttypes');\n}\n- public function load(ObjectManager $manager)\n+ public function getDependencies()\n{\n- $this->loadUsers($manager);\n- $this->loadContent($manager);\n-\n- $manager->flush();\n+ return [\n+ UserFixtures::class,\n+ TaxonomyFixtures::class,\n+ ];\n}\n- private function loadUsers(ObjectManager $manager)\n+ public function load(ObjectManager $manager)\n{\n- foreach ($this->getUserData() as [$fullname, $username, $password, $email, $roles]) {\n- $user = new User();\n- $user->setFullName($fullname);\n- $user->setUsername($username);\n- $user->setPassword($this->passwordEncoder->encodePassword($user, $password));\n- $user->setEmail($email);\n- $user->setRoles($roles);\n-\n- $manager->persist($user);\n- $this->addReference($username, $user);\n- }\n+ $this->loadContent($manager);\n$manager->flush();\n}\n- private function getUserData(): array\n- {\n- return [\n- // $userData = [$fullname, $username, $password, $email, $roles];\n- ['Admin', 'admin', 'admin%1', 'admin@example.org', ['ROLE_ADMIN']],\n- ['Gekke Henkie', 'henkie', 'henkie%1', 'henkie@example.org', ['ROLE_EDITOR']],\n- ['Jane Doe', 'jane_admin', 'kitten', 'jane_admin@symfony.com', ['ROLE_ADMIN']],\n- ['Tom Doe', 'tom_admin', 'kitten', 'tom_admin@symfony.com', ['ROLE_ADMIN']],\n- ['John Doe', 'john_user', 'kitten', 'john_user@symfony.com', ['ROLE_USER']],\n- ];\n- }\n-\nprivate function loadContent(ObjectManager $manager)\n{\nforeach ($this->config as $contentType) {\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/DataFixtures/TaxonomyFixtures.php", "diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\DataFixtures;\n+\n+use Bolt\\Common\\Str;\n+use Bolt\\Configuration\\Config;\n+use Bolt\\Entity\\Taxonomy;\n+use Cocur\\Slugify\\Slugify;\n+use Doctrine\\Bundle\\FixturesBundle\\Fixture;\n+use Doctrine\\Common\\DataFixtures\\DependentFixtureInterface;\n+use Doctrine\\Common\\Persistence\\ObjectManager;\n+\n+class TaxonomyFixtures extends Fixture implements DependentFixtureInterface\n+{\n+ private $config;\n+\n+ public function __construct(Config $config)\n+ {\n+ $this->config = $config->get('taxonomies');\n+ }\n+\n+ public function getDependencies()\n+ {\n+ return [\n+ UserFixtures::class,\n+ ];\n+ }\n+\n+ public function load(ObjectManager $manager)\n+ {\n+ $this->loadTaxonomies($manager);\n+\n+ $manager->flush();\n+ }\n+\n+ private function loadTaxonomies(ObjectManager $manager)\n+ {\n+ $slugify = Slugify::create();\n+ $order = 1;\n+\n+ foreach ($this->config as $taxonomyDefinition) {\n+ dump($taxonomyDefinition);\n+ if (!empty($taxonomyDefinition['options'])) {\n+ $options = $taxonomyDefinition['options'];\n+ } else {\n+ $options = $this->getOptions();\n+ }\n+\n+ foreach ($options as $key => $value) {\n+ $taxonomy = new Taxonomy();\n+\n+ if (is_numeric($key)) {\n+ $key = $value;\n+ }\n+\n+ $taxonomy->setType($taxonomyDefinition['slug'])\n+ ->setSlug($slugify->slugify($key))\n+ ->setName(Str::humanize($value))\n+ ->setSortorder($taxonomyDefinition['has_sortorder'] ? $order++ : 0)\n+ ;\n+\n+ $manager->persist($taxonomy);\n+ $reference = \"taxonomy_\" . $taxonomyDefinition['slug'] . \"_\" . $slugify->slugify($key);\n+ $this->addReference($reference, $taxonomy);\n+ }\n+\n+\n+ }\n+ }\n+\n+ private function getOptions()\n+ {\n+ return ['action', 'adult', 'adventure', 'alpha', 'animals', 'animation', 'anime', 'architecture', 'art',\n+ 'astronomy', 'baby', 'batshitinsane', 'biography', 'biology', 'book', 'books', 'business',\n+ 'camera', 'cars', 'cats', 'cinema', 'classic', 'comedy', 'comics', 'computers', 'cookbook', 'cooking',\n+ 'crime', 'culture', 'dark', 'design', 'digital', 'documentary', 'dogs', 'drama', 'drugs', 'education',\n+ 'environment', 'evolution', 'family', 'fantasy', 'fashion', 'fiction', 'film', 'fitness', 'food',\n+ 'football', 'fun', 'gaming', 'gift', 'health', 'hip', 'historical', 'history', 'horror', 'humor',\n+ 'illustration', 'inspirational', 'internet', 'journalism', 'kids', 'language', 'law', 'literature', 'love',\n+ 'magic', 'math', 'media', 'medicine', 'military', 'money', 'movies', 'mp3', 'murder', 'music', 'mystery',\n+ 'news', 'nonfiction', 'nsfw', 'paranormal', 'parody', 'philosophy', 'photography', 'photos', 'physics',\n+ 'poetry', 'politics', 'post-apocalyptic', 'privacy', 'psychology', 'radio', 'relationships', 'research',\n+ 'rock', 'romance', 'rpg', 'satire', 'science', 'sciencefiction', 'scifi', 'security', 'self-help',\n+ 'series', 'software', 'space', 'spirituality', 'sports', 'story', 'suspense', 'technology', 'teen',\n+ 'television', 'terrorism', 'thriller', 'travel', 'tv', 'uk', 'urban', 'us', 'usa', 'vampire', 'video',\n+ 'videogames', 'war', 'web', 'women', 'world', 'writing', 'wtf', 'zombies',\n+ ];\n+ }\n+\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/DataFixtures/UserFixtures.php", "diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\DataFixtures;\n+\n+use Bolt\\Entity\\User;\n+use Doctrine\\Bundle\\FixturesBundle\\Fixture;\n+use Doctrine\\Common\\Persistence\\ObjectManager;\n+use Symfony\\Component\\Security\\Core\\Encoder\\UserPasswordEncoderInterface;\n+\n+class UserFixtures extends Fixture\n+{\n+ /** @var UserPasswordEncoderInterface */\n+ private $passwordEncoder;\n+\n+ public function __construct(UserPasswordEncoderInterface $passwordEncoder)\n+ {\n+ $this->passwordEncoder = $passwordEncoder;\n+ }\n+\n+ public function load(ObjectManager $manager)\n+ {\n+ $this->loadUsers($manager);\n+\n+ $manager->flush();\n+ }\n+\n+ private function loadUsers(ObjectManager $manager)\n+ {\n+ foreach ($this->getUserData() as [$fullname, $username, $password, $email, $roles]) {\n+ $user = new User();\n+ $user->setFullName($fullname);\n+ $user->setUsername($username);\n+ $user->setPassword($this->passwordEncoder->encodePassword($user, $password));\n+ $user->setEmail($email);\n+ $user->setRoles($roles);\n+\n+ $manager->persist($user);\n+ $this->addReference($username, $user);\n+ }\n+\n+ $manager->flush();\n+ }\n+\n+ private function getUserData(): array\n+ {\n+ return [\n+ // $userData = [$fullname, $username, $password, $email, $roles];\n+ ['Admin', 'admin', 'admin%1', 'admin@example.org', ['ROLE_ADMIN']],\n+ ['Gekke Henkie', 'henkie', 'henkie%1', 'henkie@example.org', ['ROLE_EDITOR']],\n+ ['Jane Doe', 'jane_admin', 'kitten', 'jane_admin@example.org', ['ROLE_ADMIN']],\n+ ['Tom Doe', 'tom_admin', 'kitten', 'tom_admin@example.org', ['ROLE_ADMIN']],\n+ ['John Doe', 'john_user', 'kitten', 'john_user@example.org', ['ROLE_USER']],\n+ ];\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/Content.php", "new_path": "src/Entity/Content.php", "diff": "@@ -110,6 +110,12 @@ class Content\npublic $magiclink;\npublic $magiceditlink;\n+ /**\n+ * @ORM\\ManyToMany(targetEntity=\"Bolt\\Entity\\Taxonomy\", mappedBy=\"content\")\n+ * @ORM\\JoinTable(name=\"bolt_taxonomy_content\")\n+ */\n+ private $taxonomies;\n+\npublic function __construct()\n{\n$this->createdAt = new \\DateTime();\n@@ -117,6 +123,7 @@ class Content\n$this->publishedAt = new \\DateTime();\n$this->depublishedAt = new \\DateTime();\n$this->fields = new ArrayCollection();\n+ $this->taxonomies = new ArrayCollection();\n}\npublic function getId(): ?int\n@@ -300,4 +307,32 @@ class Content\nreturn $options;\n}\n+\n+ /**\n+ * @return Collection|Taxonomy[]\n+ */\n+ public function getTaxonomies(): Collection\n+ {\n+ return $this->taxonomies;\n+ }\n+\n+ public function addTaxonomy(Taxonomy $taxonomy): self\n+ {\n+ if (!$this->taxonomies->contains($taxonomy)) {\n+ $this->taxonomies[] = $taxonomy;\n+ $taxonomy->addContent($this);\n+ }\n+\n+ return $this;\n+ }\n+\n+ public function removeTaxonomy(Taxonomy $taxonomy): self\n+ {\n+ if ($this->taxonomies->contains($taxonomy)) {\n+ $this->taxonomies->removeElement($taxonomy);\n+ $taxonomy->removeContent($this);\n+ }\n+\n+ return $this;\n+ }\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/Media.php", "new_path": "src/Entity/Media.php", "diff": "@@ -4,8 +4,6 @@ declare(strict_types=1);\nnamespace Bolt\\Entity;\n-use Doctrine\\Common\\Collections\\ArrayCollection;\n-use Doctrine\\Common\\Collections\\Collection;\nuse Doctrine\\ORM\\Mapping as ORM;\n/**\n@@ -57,7 +55,10 @@ class Media\nprivate $filesize;\n/**\n- * @ORM\\ManyToMany(targetEntity=\"Bolt\\Entity\\User\", inversedBy=\"media\")\n+ * @var User\n+ *\n+ * @ORM\\ManyToOne(targetEntity=\"Bolt\\Entity\\User\")\n+ * @ORM\\JoinColumn(nullable=false)\n*/\nprivate $author;\n@@ -93,7 +94,6 @@ class Media\npublic function __construct()\n{\n- $this->author = new ArrayCollection();\n}\npublic function getId(): ?int\n@@ -265,29 +265,13 @@ class Media\nreturn $this;\n}\n- /**\n- * @return Collection|User[]\n- */\n- public function getAuthor(): Collection\n+ public function getAuthor(): User\n{\nreturn $this->author;\n}\n- public function addAuthor(User $author): self\n+ public function setAuthor(?User $author): void\n{\n- if (!$this->author->contains($author)) {\n- $this->author[] = $author;\n- }\n-\n- return $this;\n- }\n-\n- public function removeAuthor(User $author): self\n- {\n- if ($this->author->contains($author)) {\n- $this->author->removeElement($author);\n- }\n-\n- return $this;\n+ $this->author = $author;\n}\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Entity/Taxonomy.php", "diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\Entity;\n+\n+use ApiPlatform\\Core\\Annotation\\ApiResource;\n+use Doctrine\\Common\\Collections\\ArrayCollection;\n+use Doctrine\\Common\\Collections\\Collection;\n+use Doctrine\\ORM\\Mapping as ORM;\n+\n+/**\n+ * @ApiResource()\n+ * @ORM\\Entity(repositoryClass=\"Bolt\\Repository\\TaxonomyRepository\")\n+ * @ORM\\Table(name=\"bolt_taxonomy\")\n+ */\n+class Taxonomy\n+{\n+ /**\n+ * @ORM\\Id()\n+ * @ORM\\GeneratedValue()\n+ * @ORM\\Column(type=\"integer\")\n+ */\n+ private $id;\n+\n+ /**\n+ * @ORM\\ManyToMany(targetEntity=\"Bolt\\Entity\\Content\", inversedBy=\"taxonomies\")\n+ * @ORM\\JoinTable(name=\"bolt_taxonomy_content\")\n+ */\n+ private $content;\n+\n+ /**\n+ * @ORM\\Column(type=\"string\", length=191)\n+ */\n+ private $type;\n+\n+ /**\n+ * @ORM\\Column(type=\"string\", length=191)\n+ */\n+ private $slug;\n+\n+ /**\n+ * @ORM\\Column(type=\"string\", length=191)\n+ */\n+ private $name;\n+\n+ /**\n+ * @ORM\\Column(type=\"integer\")\n+ */\n+ private $sortorder;\n+\n+ public function __construct()\n+ {\n+ $this->content = new ArrayCollection();\n+ }\n+\n+ public function getId(): ?int\n+ {\n+ return $this->id;\n+ }\n+\n+ /**\n+ * @return Collection|Content[]\n+ */\n+ public function getContent(): Collection\n+ {\n+ return $this->content;\n+ }\n+\n+ public function addContent(Content $content): self\n+ {\n+ if (!$this->content->contains($content)) {\n+ $this->content[] = $content;\n+ }\n+\n+ return $this;\n+ }\n+\n+ public function removeContent(Content $content): self\n+ {\n+ if ($this->content->contains($content)) {\n+ $this->content->removeElement($content);\n+ }\n+\n+ return $this;\n+ }\n+\n+ public function getType(): ?string\n+ {\n+ return $this->type;\n+ }\n+\n+ public function setType(string $type): self\n+ {\n+ $this->type = $type;\n+\n+ return $this;\n+ }\n+\n+ public function getSlug(): ?string\n+ {\n+ return $this->slug;\n+ }\n+\n+ public function setSlug(string $slug): self\n+ {\n+ $this->slug = $slug;\n+\n+ return $this;\n+ }\n+\n+ public function getName(): ?string\n+ {\n+ return $this->name;\n+ }\n+\n+ public function setName(string $name): self\n+ {\n+ $this->name = $name;\n+\n+ return $this;\n+ }\n+\n+ public function getSortorder(): ?int\n+ {\n+ return $this->sortorder;\n+ }\n+\n+ public function setSortorder(int $sortorder): self\n+ {\n+ $this->sortorder = $sortorder;\n+\n+ return $this;\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/User.php", "new_path": "src/Entity/User.php", "diff": "@@ -4,8 +4,6 @@ declare(strict_types=1);\nnamespace Bolt\\Entity;\n-use Doctrine\\Common\\Collections\\ArrayCollection;\n-use Doctrine\\Common\\Collections\\Collection;\nuse Doctrine\\ORM\\Mapping as ORM;\nuse Symfony\\Component\\Security\\Core\\User\\UserInterface;\nuse Symfony\\Component\\Validator\\Constraints as Assert;\n@@ -74,14 +72,8 @@ class User implements UserInterface, \\Serializable\n*/\nprivate $lastIp;\n- /**\n- * @ORM\\ManyToMany(targetEntity=\"Bolt\\Entity\\Media\", mappedBy=\"author\")\n- */\n- private $media;\n-\npublic function __construct()\n{\n- $this->media = new ArrayCollection();\n}\npublic function getId(): int\n@@ -220,32 +212,4 @@ class User implements UserInterface, \\Serializable\nreturn $this;\n}\n-\n- /**\n- * @return Collection|Media[]\n- */\n- public function getMedia(): Collection\n- {\n- return $this->media;\n- }\n-\n- public function addMedia(Media $media): self\n- {\n- if (!$this->media->contains($media)) {\n- $this->media[] = $media;\n- $media->addAuthor($this);\n- }\n-\n- return $this;\n- }\n-\n- public function removeMedia(Media $media): self\n- {\n- if ($this->media->contains($media)) {\n- $this->media->removeElement($media);\n- $media->removeAuthor($this);\n- }\n-\n- return $this;\n- }\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Repository/TaxonomyRepository.php", "diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\Repository;\n+\n+use Bolt\\Entity\\Taxonomy;\n+use Doctrine\\Bundle\\DoctrineBundle\\Repository\\ServiceEntityRepository;\n+use Symfony\\Bridge\\Doctrine\\RegistryInterface;\n+\n+/**\n+ * @method Taxonomy|null find($id, $lockMode = null, $lockVersion = null)\n+ * @method Taxonomy|null findOneBy(array $criteria, array $orderBy = null)\n+ * @method Taxonomy[] findAll()\n+ * @method Taxonomy[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)\n+ */\n+class TaxonomyRepository extends ServiceEntityRepository\n+{\n+ public function __construct(RegistryInterface $registry)\n+ {\n+ parent::__construct($registry, Taxonomy::class);\n+ }\n+\n+// /**\n+// * @return Taxonomy[] Returns an array of Taxonomy objects\n+// */\n+ /*\n+ public function findByExampleField($value)\n+ {\n+ return $this->createQueryBuilder('t')\n+ ->andWhere('t.exampleField = :val')\n+ ->setParameter('val', $value)\n+ ->orderBy('t.id', 'ASC')\n+ ->setMaxResults(10)\n+ ->getQuery()\n+ ->getResult()\n+ ;\n+ }\n+ */\n+\n+ /*\n+ public function findOneBySomeField($value): ?Taxonomy\n+ {\n+ return $this->createQueryBuilder('t')\n+ ->andWhere('t.exampleField = :val')\n+ ->setParameter('val', $value)\n+ ->getQuery()\n+ ->getOneOrNullResult()\n+ ;\n+ }\n+ */\n+}\n" } ]
PHP
MIT License
bolt/core
Working on adding taxonomies
95,168
16.10.2018 09:34:32
-7,200
a5c260815da6da5ec6a52d5610de7d16356fcea6
Move selectoptionsfromarray function logic to ContentHelperRuntime
[ { "change_type": "MODIFY", "old_path": "src/Twig/Extension/ContentHelperExtension.php", "new_path": "src/Twig/Extension/ContentHelperExtension.php", "diff": "@@ -6,7 +6,7 @@ namespace Bolt\\Twig\\Extension;\nuse Bolt\\Content\\FieldFactory;\nuse Bolt\\Content\\MenuBuilder;\n-use Bolt\\Entity\\Field;\n+use Bolt\\Twig\\Runtime;\nuse Twig\\Extension\\AbstractExtension;\nuse Twig\\TwigFunction;\n@@ -37,7 +37,7 @@ class ContentHelperExtension extends AbstractExtension\nreturn [\nnew TwigFunction('sidebarmenu', [$this, 'sidebarmenu']),\nnew TwigFunction('fieldfactory', [$this, 'fieldfactory']),\n- new TwigFunction('selectoptionsfromarray', [$this, 'selectoptionsfromarray']),\n+ new TwigFunction('selectoptionsfromarray', [Runtime\\ContentHelperRuntime::class, 'selectoptionsfromarray']),\n];\n}\n@@ -56,30 +56,4 @@ class ContentHelperExtension extends AbstractExtension\nreturn $field;\n}\n-\n- public function selectoptionsfromarray(Field $field)\n- {\n- $values = $field->getDefinition()->get('values');\n- $currentValues = $field->getValue();\n-\n- $options = [];\n-\n- if ($field->getDefinition()->get('required', false)) {\n- $options[] = [\n- 'key' => '',\n- 'value' => '',\n- 'selected' => false,\n- ];\n- }\n-\n- foreach ($values as $key => $value) {\n- $options[] = [\n- 'key' => $key,\n- 'value' => $value,\n- 'selected' => in_array($key, $currentValues, true),\n- ];\n- }\n-\n- return $options;\n- }\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Twig/Runtime/ContentHelperRuntime.php", "diff": "+<?php declare(strict_types=1);\n+\n+namespace Bolt\\Twig\\Runtime;\n+\n+use Bolt\\Entity\\Field;\n+\n+class ContentHelperRuntime\n+{\n+ public function dummy($input = null)\n+ {\n+ return $input;\n+ }\n+\n+ public function selectoptionsfromarray(Field $field)\n+ {\n+ $values = $field->getDefinition()->get('values');\n+ $currentValues = $field->getValue();\n+\n+ $options = [];\n+\n+ if ($field->getDefinition()->get('required', false)) {\n+ $options[] = [\n+ 'key' => '',\n+ 'value' => '',\n+ 'selected' => false,\n+ ];\n+ }\n+\n+ foreach ($values as $key => $value) {\n+ $options[] = [\n+ 'key' => $key,\n+ 'value' => $value,\n+ 'selected' => in_array($key, $currentValues, true),\n+ ];\n+ }\n+\n+ return $options;\n+ }\n+}\n" } ]
PHP
MIT License
bolt/core
Move selectoptionsfromarray function logic to ContentHelperRuntime
95,168
16.10.2018 11:06:39
-7,200
fbb835dfc1ad9d69be3c9eb4fc7b28d0075f008c
Use Bolt\Twig\Runtime and dummy function
[ { "change_type": "MODIFY", "old_path": "src/Twig/Extension/AdminExtension.php", "new_path": "src/Twig/Extension/AdminExtension.php", "diff": "namespace Bolt\\Twig\\Extension;\n+use Bolt\\Twig\\Runtime;\nuse Twig\\Extension\\AbstractExtension;\nuse Twig\\TwigFilter;\nuse Twig\\TwigFunction;\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/Extension/ArrayExtension.php", "new_path": "src/Twig/Extension/ArrayExtension.php", "diff": "namespace Bolt\\Twig\\Extension;\n+use Bolt\\Twig\\Runtime;\nuse Twig\\Extension\\AbstractExtension;\nuse Twig\\TwigFilter;\nuse Twig\\TwigFunction;\n@@ -22,7 +23,7 @@ class ArrayExtension extends AbstractExtension\nreturn [\n// @codingStandardsIgnoreStart\n- new TwigFunction('unique', [$this, 'dummy'], $safe),\n+ new TwigFunction('unique', [Runtime\\ArrayRuntime::class, 'dummy'], $safe),\n// @codingStandardsIgnoreEnd\n];\n}\n@@ -34,8 +35,8 @@ class ArrayExtension extends AbstractExtension\n{\nreturn [\n// @codingStandardsIgnoreStart\n- new TwigFilter('order', [$this, 'dummy']),\n- new TwigFilter('shuffle', [$this, 'dummy']),\n+ new TwigFilter('order', [Runtime\\ArrayRuntime::class, 'dummy']),\n+ new TwigFilter('shuffle', [Runtime\\ArrayRuntime::class, 'dummy']),\n// @codingStandardsIgnoreEnd\n];\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/Extension/BoltExtension.php", "new_path": "src/Twig/Extension/BoltExtension.php", "diff": "namespace Bolt\\Twig\\Extension;\n+use Bolt\\Twig\\Runtime;\nuse Twig\\Extension\\AbstractExtension;\nuse Twig\\TwigFilter;\nuse Twig\\TwigFunction;\n@@ -20,8 +21,8 @@ class BoltExtension extends AbstractExtension\nreturn [\n// @codingStandardsIgnoreStart\n- new TwigFunction('first', 'dummy', $env),\n- new TwigFunction('last', 'dummy', $env),\n+ new TwigFunction('first', [Runtime\\BoltRuntime::class, 'dummy'], $env),\n+ new TwigFunction('last', [Runtime\\BoltRuntime::class, 'dummy'], $env),\n// @codingStandardsIgnoreEnd\n];\n}\n@@ -32,10 +33,9 @@ class BoltExtension extends AbstractExtension\npublic function getFilters()\n{\n$env = ['needs_environment' => true];\n- $deprecated = ['deprecated' => true];\nreturn [\n- new TwigFilter('ucfirst', 'dummy', $env + ['alternative' => 'capitalize']),\n+ new TwigFilter('ucfirst', [Runtime\\BoltRuntime::class, 'dummy'], $env + ['alternative' => 'capitalize']),\n];\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/Extension/HtmlExtension.php", "new_path": "src/Twig/Extension/HtmlExtension.php", "diff": "namespace Bolt\\Twig\\Extension;\n+use Bolt\\Twig\\Runtime;\nuse Twig\\Extension\\AbstractExtension;\nuse Twig\\TwigFilter;\nuse Twig\\TwigFunction;\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/Extension/RoutingExtension.php", "new_path": "src/Twig/Extension/RoutingExtension.php", "diff": "namespace Bolt\\Twig\\Extension;\n+use Bolt\\Twig\\Runtime;\nuse Twig\\Extension\\AbstractExtension;\nuse Twig\\TwigFunction;\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/Extension/SourceCodeExtension.php", "new_path": "src/Twig/Extension/SourceCodeExtension.php", "diff": "@@ -4,6 +4,7 @@ declare(strict_types=1);\nnamespace Bolt\\Twig\\Extension;\n+use Bolt\\Twig\\Runtime;\nuse Twig\\Environment;\nuse Twig\\Extension\\AbstractExtension;\nuse Twig\\Template;\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/Extension/TextExtension.php", "new_path": "src/Twig/Extension/TextExtension.php", "diff": "<?php declare(strict_types=1);\nnamespace Bolt\\Twig\\Extension;\n+\n+use Bolt\\Twig\\Runtime;\nuse Twig\\Extension\\AbstractExtension;\nuse Twig\\TwigFilter;\nuse Twig\\TwigTest;\n@@ -19,9 +21,9 @@ class TextExtension extends AbstractExtension\nreturn [\n// @codingStandardsIgnoreStart\n- new TwigFilter('json_decode', [Runtime\\TextRuntime::class, 'jsonDecode']),\n- new TwigFilter('safestring', [Runtime\\TextRuntime::class, 'safeString'], $safe),\n- new TwigFilter('slug', [Runtime\\TextRuntime::class, 'slug']),\n+ new TwigFilter('json_decode', [Runtime\\TextRuntime::class, 'dummy']),\n+ new TwigFilter('safestring', [Runtime\\TextRuntime::class, 'dummy'], $safe),\n+ new TwigFilter('slug', [Runtime\\TextRuntime::class, 'dummy']),\n// @codingStandardsIgnoreEnd\n];\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/Extension/UserExtension.php", "new_path": "src/Twig/Extension/UserExtension.php", "diff": "namespace Bolt\\Twig\\Extension;\n+use Bolt\\Twig\\Runtime;\nuse Twig\\Extension\\AbstractExtension;\nuse Twig\\TwigFunction;\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/Extension/WidgetExtension.php", "new_path": "src/Twig/Extension/WidgetExtension.php", "diff": "namespace Bolt\\Twig\\Extension;\n+use Bolt\\Twig\\Runtime;\nuse Twig\\Extension\\AbstractExtension;\nuse Twig\\TwigFunction;\n" } ]
PHP
MIT License
bolt/core
Use Bolt\Twig\Runtime and dummy function
95,168
16.10.2018 11:47:34
-7,200
2a4d00e5c937b7d5415155e3f06e4f87f1520d11
Add ImageRuntime.php
[ { "change_type": "MODIFY", "old_path": "src/Twig/Extension/ImageExtension.php", "new_path": "src/Twig/Extension/ImageExtension.php", "diff": "@@ -6,6 +6,7 @@ namespace Bolt\\Twig\\Extension;\nuse Bolt\\Configuration\\Config;\nuse Bolt\\Entity\\Field;\n+use Bolt\\Twig\\Runtime;\nuse League\\Glide\\Urls\\UrlBuilderFactory;\nuse Twig\\Extension\\AbstractExtension;\nuse Twig\\TwigFilter;\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Twig/Runtime/ImageRuntime.php", "diff": "+<?php declare(strict_types=1);\n+\n+namespace Bolt\\Twig\\Runtime;\n+\n+/**\n+ * Bolt specific Twig functions and filters that provide image support.\n+ */\n+class ImageRuntime\n+{\n+ public function dummy($input = null)\n+ {\n+ return $input;\n+ }\n+}\n\\ No newline at end of file\n" } ]
PHP
MIT License
bolt/core
Add ImageRuntime.php
95,168
16.10.2018 12:00:36
-7,200
0db869e8590fb0f90e98d277a97709d3ed2f2e0b
Port ymllink Twig filter
[ { "change_type": "MODIFY", "old_path": "src/Twig/Extension/AdminExtension.php", "new_path": "src/Twig/Extension/AdminExtension.php", "diff": "@@ -33,7 +33,7 @@ class AdminExtension extends AbstractExtension\nreturn [\n// @codingStandardsIgnoreStart\nnew TwigFilter('__', [Runtime\\AdminRuntime::class, 'dummy']),\n- new TwigFilter('ymllink', [Runtime\\AdminRuntime::class, 'dummy'], $safe),\n+ new TwigFilter('ymllink', [Runtime\\AdminRuntime::class, 'ymllink'], $safe),\n// @codingStandardsIgnoreEnd\n];\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/Runtime/AdminRuntime.php", "new_path": "src/Twig/Runtime/AdminRuntime.php", "diff": "namespace Bolt\\Twig\\Runtime;\n+use Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface;\n+\n/**\n* Bolt specific Twig functions and filters for backend.\n*/\nclass AdminRuntime\n{\n+ /** @var UrlGeneratorInterface */\n+ private $urlGenerator;\n+\n+ /**\n+ * Constructor.\n+ *\n+ * @param UrlGeneratorInterface $urlGenerator\n+ */\n+ public function __construct(\n+ UrlGeneratorInterface $urlGenerator\n+ ) {\n+ $this->urlGenerator = $urlGenerator;\n+ }\n+\npublic function dummy($input = null)\n{\nreturn $input;\n}\n+\n+ /**\n+ * Create a link to edit a .yml file, if a filename is detected in the string. Mostly\n+ * for use in Flashbag messages, to allow easy editing.\n+ *\n+ * @param string $str\n+ *\n+ * @return string Resulting string\n+ */\n+ public function ymllink($str)\n+ {\n+ return preg_replace_callback(\n+ '/([a-z0-9_-]+\\.yml)/i',\n+ function ($matches) {\n+ $path = $this->urlGenerator->generate('bolt_edit_file', ['area' => 'config', 'file' => '/' . $matches[1]]);\n+ $link = sprintf(' <a href=\"%s\">%s</a>', $path, $matches[1]);\n+\n+ return $link;\n+ },\n+ $str\n+ );\n+ }\n}\n" } ]
PHP
MIT License
bolt/core
Port ymllink Twig filter
95,168
16.10.2018 12:32:49
-7,200
5e4ab831cab74e89ab7d141d3530de4ae4e1ec74
Port ArrayExtension Twig filters
[ { "change_type": "MODIFY", "old_path": "src/Twig/Extension/ArrayExtension.php", "new_path": "src/Twig/Extension/ArrayExtension.php", "diff": "@@ -23,7 +23,7 @@ class ArrayExtension extends AbstractExtension\nreturn [\n// @codingStandardsIgnoreStart\n- new TwigFunction('unique', [Runtime\\ArrayRuntime::class, 'dummy'], $safe),\n+ new TwigFunction('unique', [Runtime\\ArrayRuntime::class, 'unique'], $safe),\n// @codingStandardsIgnoreEnd\n];\n}\n@@ -35,8 +35,8 @@ class ArrayExtension extends AbstractExtension\n{\nreturn [\n// @codingStandardsIgnoreStart\n- new TwigFilter('order', [Runtime\\ArrayRuntime::class, 'dummy']),\n- new TwigFilter('shuffle', [Runtime\\ArrayRuntime::class, 'dummy']),\n+ new TwigFilter('order', [Runtime\\ArrayRuntime::class, 'order']),\n+ new TwigFilter('shuffle', [Runtime\\ArrayRuntime::class, 'shuffle']),\n// @codingStandardsIgnoreEnd\n];\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/Runtime/ArrayRuntime.php", "new_path": "src/Twig/Runtime/ArrayRuntime.php", "diff": "@@ -4,8 +4,151 @@ namespace Bolt\\Twig\\Runtime;\nclass ArrayRuntime\n{\n+ private $orderOn;\n+ private $orderAscending;\n+ private $orderOnSecondary;\n+ private $orderAscendingSecondary;\n+\npublic function dummy($input = null)\n{\nreturn $input;\n}\n+\n+ /**\n+ * Takes two arrays and returns a compiled array of unique, sorted values.\n+ *\n+ * @param array $arr1\n+ * @param array $arr2\n+ *\n+ * @return array\n+ */\n+ public function unique(array $arr1, array $arr2)\n+ {\n+ $merged = array_unique(array_merge($arr1, $arr2), SORT_REGULAR);\n+ $compiled = [];\n+\n+ foreach ($merged as $key => $val) {\n+ if (is_array($val) && array_values($val) === $val) {\n+ $compiled[$key] = $val;\n+ } else {\n+ $compiled[$val] = $val;\n+ }\n+ }\n+\n+ return $compiled;\n+ }\n+\n+ /**\n+ * Randomly shuffle the contents of a passed array.\n+ *\n+ * @param array $array\n+ *\n+ * @return array\n+ */\n+ public function shuffle($array)\n+ {\n+ if (is_array($array)) {\n+ shuffle($array);\n+ }\n+\n+ return $array;\n+ }\n+\n+ /**\n+ * Sorts / orders items of an array.\n+ *\n+ * @param array $array\n+ * @param string $on\n+ * @param string $onSecondary\n+ *\n+ * @throws \\InvalidArgumentException\n+ *\n+ * @return array\n+ */\n+ public function order(array $array, $on, $onSecondary = null)\n+ {\n+ // If we don't get a string, we can't determine a sort order.\n+ if (!is_string($on)) {\n+ throw new \\InvalidArgumentException(sprintf('Second parameter passed to %s must be a string, %s given', __METHOD__, gettype($on)));\n+ }\n+ if (!(is_string($onSecondary) || $onSecondary === null)) {\n+ throw new \\InvalidArgumentException(sprintf('Third parameter passed to %s must be a string, %s given', __METHOD__, gettype($onSecondary)));\n+ }\n+ // Set the 'orderOn' and 'orderAscending', taking into account things like '-datepublish'.\n+ list($this->orderOn, $this->orderAscending) = $this->getSortOrder($on);\n+\n+ // Set the secondary order, if any.\n+ if ($onSecondary) {\n+ list($this->orderOnSecondary, $this->orderAscendingSecondary) = $this->getSortOrder($onSecondary);\n+ } else {\n+ $this->orderOnSecondary = false;\n+ $this->orderAscendingSecondary = false;\n+ }\n+\n+ uasort($array, [$this, 'orderHelper']);\n+\n+ return $array;\n+ }\n+\n+ /**\n+ * Get sorting order of name, stripping possible \"DESC\", \"ASC\", and also\n+ * return the sorting order.\n+ *\n+ * @param string $name\n+ *\n+ * @return array\n+ */\n+ private function getSortOrder($name = '-datepublish')\n+ {\n+ $parts = explode(' ', $name);\n+ $fieldName = $parts[0];\n+ $sort = 'ASC';\n+ if (isset($parts[1])) {\n+ $sort = $parts[1];\n+ }\n+\n+ if ($fieldName[0] === '-') {\n+ $fieldName = substr($fieldName, 1);\n+ $sort = 'DESC';\n+ }\n+\n+ return [$fieldName, (strtoupper($sort) === 'ASC')];\n+ }\n+\n+ /**\n+ * Helper function for sorting an array of \\Bolt\\Legacy\\Content.\n+ *\n+ * @param \\Bolt\\Legacy\\Content|array $a\n+ * @param \\Bolt\\Legacy\\Content|array $b\n+ *\n+ * @return bool\n+ */\n+ private function orderHelper($a, $b)\n+ {\n+ $aVal = $a[$this->orderOn];\n+ $bVal = $b[$this->orderOn];\n+\n+ // Check the primary sorting criterion.\n+ if ($aVal < $bVal) {\n+ return !$this->orderAscending;\n+ } elseif ($aVal > $bVal) {\n+ return $this->orderAscending;\n+ }\n+ // Primary criterion is the same. Use the secondary criterion, if it is set. Otherwise return 0.\n+ if (empty($this->orderOnSecondary)) {\n+ return 0;\n+ }\n+\n+ $aVal = $a[$this->orderOnSecondary];\n+ $bVal = $b[$this->orderOnSecondary];\n+\n+ if ($aVal < $bVal) {\n+ return !$this->orderAscendingSecondary;\n+ } elseif ($aVal > $bVal) {\n+ return $this->orderAscendingSecondary;\n+ }\n+\n+ // both criteria are the same. Whatever!\n+ return 0;\n+ }\n}\n" } ]
PHP
MIT License
bolt/core
Port ArrayExtension Twig filters
95,168
16.10.2018 13:48:26
-7,200
f2029f8f63b790a62be577aab7864f20a5ed80e9
Port twig Twig filter
[ { "change_type": "MODIFY", "old_path": "src/Twig/Extension/HtmlExtension.php", "new_path": "src/Twig/Extension/HtmlExtension.php", "diff": "@@ -38,7 +38,7 @@ class HtmlExtension extends AbstractExtension\nreturn [\n// @codingStandardsIgnoreStart\nnew TwigFilter('markdown', [Runtime\\HtmlRuntime::class, 'dummy'], $safe),\n- new TwigFilter('twig', [Runtime\\HtmlRuntime::class, 'dummy'], $env + $safe),\n+ new TwigFilter('twig', [Runtime\\HtmlRuntime::class, 'twig'], $env + $safe),\n// @codingStandardsIgnoreEnd\n];\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/Runtime/HtmlRuntime.php", "new_path": "src/Twig/Runtime/HtmlRuntime.php", "diff": "namespace Bolt\\Twig\\Runtime;\n+use Twig\\Environment;\n+\n/**\n* Bolt specific Twig functions and filters for HTML.\n*/\n@@ -11,4 +13,20 @@ class HtmlRuntime\n{\nreturn $input;\n}\n+\n+ /**\n+ * Formats the given string as Twig in HTML.\n+ *\n+ * @param Environment $env\n+ * @param string $snippet\n+ * @param array $context\n+ *\n+ * @return string Twig output\n+ */\n+ public function twig(Environment $env, $snippet, $context = [])\n+ {\n+ $template = $env->createTemplate((string) $snippet);\n+\n+ return twig_include($env, $context, $template, [], true, false, true);\n+ }\n}\n" } ]
PHP
MIT License
bolt/core
Port twig Twig filter
95,144
16.10.2018 16:06:24
-7,200
20b8752fbddf0fc5e8e9119f01d851ecbe4f3292
Adding a Basecontroller
[ { "change_type": "MODIFY", "old_path": "public/theme/skeleton/index.twig", "new_path": "public/theme/skeleton/index.twig", "diff": "{% block main %}\n+ <hr>\n+ {{ dump() }}\n+ <hr>\n+\n{% if record is defined %}\n<h1>{{ record.title }}</h1>\n" }, { "change_type": "MODIFY", "old_path": "src/Configuration/Config.php", "new_path": "src/Configuration/Config.php", "diff": "@@ -149,8 +149,6 @@ class Config\nreturn collect($general);\n}\n-\n-\n/**\n* Read and parse the taxonomy.yml configuration file.\n*\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Controller/BaseController.php", "diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\Controller;\n+\n+use Bolt\\Configuration\\Config;\n+use Bolt\\TemplateChooser;\n+use Bolt\\Version;\n+use Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;\n+use Symfony\\Component\\HttpFoundation\\Response;\n+use Symfony\\Component\\Security\\Csrf\\CsrfTokenManagerInterface;\n+use Tightenco\\Collect\\Support\\Collection;\n+\n+class BaseController extends AbstractController\n+{\n+ /** @var Config */\n+ protected $config;\n+\n+ /** @var TemplateChooser */\n+ protected $templateChooser;\n+\n+ /** @var CsrfTokenManagerInterface */\n+ protected $csrfTokenManager;\n+\n+ public function __construct(Config $config, TemplateChooser $templateChooser, CsrfTokenManagerInterface $csrfTokenManager)\n+ {\n+ $this->config = $config;\n+ $this->templateChooser = $templateChooser;\n+ $this->csrfTokenManager = $csrfTokenManager;\n+ }\n+\n+ /**\n+ * Renders a view.\n+ *\n+ * @final\n+ *\n+ * @param mixed $template\n+ * @param array $parameters\n+ * @param Response|null $response\n+ *\n+ * @throws \\Twig_Error_Loader\n+ * @throws \\Twig_Error_Runtime\n+ * @throws \\Twig_Error_Syntax\n+ *\n+ * @return Response\n+ */\n+ protected function renderTemplate($template, array $parameters = [], Response $response = null): Response\n+ {\n+ /** @var \\Twig_Environment $twig */\n+ $twig = $this->container->get('twig');\n+\n+ // Set config and version.\n+ $parameters['config'] = $this->config;\n+ $parameters['foo'] = 'bar';\n+ $parameters['version'] = Version::VERSION;\n+\n+ // Resolve string|array of templates into the first one that is found.\n+ if ($template instanceof Collection) {\n+ $template = $twig->resolveTemplate($template->toArray());\n+ }\n+\n+ $content = $twig->render($template, $parameters);\n+\n+ if ($response === null) {\n+ $response = new Response();\n+ }\n+\n+ $response->setContent($content);\n+\n+ return $response;\n+ }\n+\n+ /**\n+ * Shortcut for {@see \\Bolt\\Config::get}.\n+ *\n+ * @param string $path\n+ * @param mixed $default\n+ *\n+ * @return string|int|array|null\n+ */\n+ protected function getOption($path, $default = null)\n+ {\n+ return $this->config->get($path, $default);\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/Bolt/BackendController.php", "new_path": "src/Controller/Bolt/BackendController.php", "diff": "@@ -4,12 +4,10 @@ declare(strict_types=1);\nnamespace Bolt\\Controller\\Bolt;\n-use Bolt\\Configuration\\Config;\n+use Bolt\\Controller\\BaseController;\nuse Bolt\\Entity\\Content;\nuse Bolt\\Repository\\ContentRepository;\n-use Bolt\\Version;\nuse Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Security;\n-use Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\Routing\\Annotation\\Route;\n@@ -19,17 +17,8 @@ use Symfony\\Component\\Routing\\Annotation\\Route;\n* @Route(\"/bolt\")\n* @Security(\"has_role('ROLE_ADMIN')\")\n*/\n-class BackendController extends AbstractController\n+class BackendController extends BaseController\n{\n- /** @var Config */\n- private $config;\n-\n- /** @param Config $config */\n- public function __construct(Config $config)\n- {\n- $this->config = $config;\n- }\n-\n/**\n* @Route(\"/\", name=\"bolt_dashboard\")\n* was: (\"/{vueRouting}\", requirements={\"vueRouting\"=\"^(?!api|_(profiler|wdt)).+\"}, name=\"index\")\n@@ -40,14 +29,11 @@ class BackendController extends AbstractController\n*/\npublic function index(ContentRepository $content)\n{\n- $version = Version::VERSION;\n-\n/** @var Content $records */\n$records = $content->findLatest();\n- return $this->render('dashboard/dashboard.twig', [\n+ return $this->renderTemplate('dashboard/dashboard.twig', [\n'records' => $records,\n- 'version' => $version,\n]);\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/Bolt/ContentListingController.php", "new_path": "src/Controller/Bolt/ContentListingController.php", "diff": "@@ -4,11 +4,10 @@ declare(strict_types=1);\nnamespace Bolt\\Controller\\Bolt;\n-use Bolt\\Configuration\\Config;\nuse Bolt\\Content\\ContentTypeFactory;\n+use Bolt\\Controller\\BaseController;\nuse Bolt\\Repository\\ContentRepository;\nuse Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Security;\n-use Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\Routing\\Annotation\\Route;\n@@ -19,16 +18,8 @@ use Symfony\\Component\\Routing\\Annotation\\Route;\n* @Route(\"/bolt\")\n* @Security(\"has_role('ROLE_ADMIN')\")\n*/\n-class ContentListingController extends AbstractController\n+class ContentListingController extends BaseController\n{\n- /** @var Config */\n- private $config;\n-\n- public function __construct(Config $config)\n- {\n- $this->config = $config;\n- }\n-\n/**\n* @Route(\"/content/{contenttype}\", name=\"bolt_contentlisting\")\n*\n@@ -36,6 +27,10 @@ class ContentListingController extends AbstractController\n* @param Request $request\n* @param string $contenttype\n*\n+ * @throws \\Twig_Error_Loader\n+ * @throws \\Twig_Error_Runtime\n+ * @throws \\Twig_Error_Syntax\n+ *\n* @return Response\n*/\npublic function listing(ContentRepository $content, Request $request, string $contenttype = ''): Response\n@@ -47,7 +42,7 @@ class ContentListingController extends AbstractController\n/** @var Content $records */\n$records = $content->findAll($page, $contenttype);\n- return $this->render('content/listing.twig', [\n+ return $this->renderTemplate('content/listing.twig', [\n'records' => $records,\n'contenttype' => $contenttype,\n]);\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/Bolt/EditFileController.php", "new_path": "src/Controller/Bolt/EditFileController.php", "diff": "@@ -4,9 +4,8 @@ declare(strict_types=1);\nnamespace Bolt\\Controller\\Bolt;\n-use Bolt\\Configuration\\Config;\n+use Bolt\\Controller\\BaseController;\nuse Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Security;\n-use Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;\nuse Symfony\\Component\\HttpFoundation\\RedirectResponse;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\n@@ -14,7 +13,6 @@ use Symfony\\Component\\Routing\\Annotation\\Route;\nuse Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface;\nuse Symfony\\Component\\Security\\Core\\Exception\\InvalidCsrfTokenException;\nuse Symfony\\Component\\Security\\Csrf\\CsrfToken;\n-use Symfony\\Component\\Security\\Csrf\\CsrfTokenManagerInterface;\nuse Symfony\\Component\\Yaml\\Exception\\ParseException;\nuse Symfony\\Component\\Yaml\\Parser;\nuse Webmozart\\PathUtil\\Path;\n@@ -25,31 +23,17 @@ use Webmozart\\PathUtil\\Path;\n* @Route(\"/bolt\")\n* @Security(\"has_role('ROLE_ADMIN')\")\n*/\n-class EditFileController extends AbstractController\n+class EditFileController extends BaseController\n{\n- /** @var Config */\n- private $config;\n-\n- /** @var CsrfTokenManagerInterface */\n- private $csrfTokenManager;\n-\n- /**\n- * EditFileController constructor.\n- *\n- * @param Config $config\n- * @param CsrfTokenManagerInterface $csrfTokenManager\n- */\n- public function __construct(Config $config, CsrfTokenManagerInterface $csrfTokenManager)\n- {\n- $this->config = $config;\n- $this->csrfTokenManager = $csrfTokenManager;\n- }\n-\n/**\n* @Route(\"/editfile/{area}\", name=\"bolt_edit_file\", methods={\"GET\"})\n*\n* @param string $area\n- * @param string $file\n+ * @param Request $request\n+ *\n+ * @throws \\Twig_Error_Loader\n+ * @throws \\Twig_Error_Runtime\n+ * @throws \\Twig_Error_Syntax\n*\n* @return Response\n*/\n@@ -66,7 +50,7 @@ class EditFileController extends AbstractController\n'contents' => $contents,\n];\n- return $this->render('finder/editfile.twig', $context);\n+ return $this->renderTemplate('finder/editfile.twig', $context);\n}\n/**\n@@ -99,7 +83,7 @@ class EditFileController extends AbstractController\n'contents' => $contents,\n];\n- return $this->render('finder/editfile.twig', $context);\n+ return $this->renderTemplate('finder/editfile.twig', $context);\n}\n$basepath = $this->config->getPath($area);\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/Bolt/EditMediaController.php", "new_path": "src/Controller/Bolt/EditMediaController.php", "diff": "@@ -10,11 +10,11 @@ namespace Bolt\\Controller\\Bolt;\nuse Bolt\\Configuration\\Areas;\nuse Bolt\\Configuration\\Config;\nuse Bolt\\Content\\MediaFactory;\n+use Bolt\\Controller\\BaseController;\nuse Bolt\\Entity\\Media;\nuse Bolt\\Repository\\MediaRepository;\nuse Doctrine\\Common\\Persistence\\ObjectManager;\nuse Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Security;\n-use Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;\nuse Symfony\\Component\\Finder\\SplFileInfo;\nuse Symfony\\Component\\HttpFoundation\\RedirectResponse;\nuse Symfony\\Component\\HttpFoundation\\Request;\n@@ -32,14 +32,8 @@ use Webmozart\\PathUtil\\Path;\n* @Route(\"/bolt\")\n* @Security(\"has_role('ROLE_ADMIN')\")\n*/\n-class EditMediaController extends AbstractController\n+class EditMediaController extends BaseController\n{\n- /** @var Config */\n- private $config;\n-\n- /** @var CsrfTokenManagerInterface */\n- private $csrfTokenManager;\n-\n/** @var ObjectManager */\nprivate $manager;\n@@ -96,7 +90,7 @@ class EditMediaController extends AbstractController\n'media' => $media,\n];\n- return $this->render('editcontent/media_edit.twig', $context);\n+ return $this->renderTemplate('editcontent/media_edit.twig', $context);\n}\n/**\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/Bolt/EditRecordController.php", "new_path": "src/Controller/Bolt/EditRecordController.php", "diff": "@@ -6,12 +6,11 @@ namespace Bolt\\Controller\\Bolt;\nuse Bolt\\Configuration\\Config;\nuse Bolt\\Content\\FieldFactory;\n+use Bolt\\Controller\\BaseController;\nuse Bolt\\Entity\\Content;\n-use Bolt\\Version;\nuse Carbon\\Carbon;\nuse Doctrine\\Common\\Persistence\\ObjectManager;\nuse Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Security;\n-use Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;\nuse Symfony\\Component\\HttpFoundation\\RedirectResponse;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\n@@ -27,17 +26,8 @@ use Symfony\\Component\\Security\\Csrf\\CsrfTokenManagerInterface;\n* @Route(\"/bolt\")\n* @Security(\"has_role('ROLE_ADMIN')\")\n*/\n-class EditRecordController extends AbstractController\n+class EditRecordController extends BaseController\n{\n- /** @var Config */\n- private $config;\n-\n- /** @var Version */\n- private $version;\n-\n- /** @var CsrfTokenManagerInterface */\n- private $csrfTokenManager;\n-\npublic function __construct(Config $config, CsrfTokenManagerInterface $csrfTokenManager)\n{\n$this->config = $config;\n@@ -46,8 +36,14 @@ class EditRecordController extends AbstractController\n/**\n* @Route(\"/edit/{id}\", name=\"bolt_edit_record\", methods={\"GET\"})\n+ *\n+ * @param string $id\n+ * @param Request $request\n+ * @param Content|null $content\n+ *\n+ * @return Response\n*/\n- public function edit(string $id, Content $content = null, Request $request): Response\n+ public function edit(string $id, Request $request, Content $content = null): Response\n{\nif (!$content) {\n$content = new Content();\n@@ -56,15 +52,22 @@ class EditRecordController extends AbstractController\n$content->setConfig($this->config);\n}\n- return $this->render('editcontent/edit.twig', [\n+ return $this->renderTemplate('editcontent/edit.twig', [\n'record' => $content,\n]);\n}\n/**\n* @Route(\"/edit/{id}\", name=\"bolt_edit_record_post\", methods={\"POST\"})\n+ *\n+ * @param Request $request\n+ * @param ObjectManager $manager\n+ * @param UrlGeneratorInterface $urlGenerator\n+ * @param Content|null $content\n+ *\n+ * @return Response\n*/\n- public function edit_post(Content $content = null, Request $request, ObjectManager $manager, UrlGeneratorInterface $urlGenerator): Response\n+ public function edit_post(Request $request, ObjectManager $manager, UrlGeneratorInterface $urlGenerator, Content $content = null): Response\n{\n$token = new CsrfToken('editrecord', $request->request->get('_csrf_token'));\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/Bolt/FinderController.php", "new_path": "src/Controller/Bolt/FinderController.php", "diff": "@@ -7,9 +7,9 @@ namespace Bolt\\Controller\\Bolt;\nuse Bolt\\Common\\Str;\nuse Bolt\\Configuration\\Areas;\nuse Bolt\\Configuration\\Config;\n+use Bolt\\Controller\\BaseController;\nuse Bolt\\Repository\\MediaRepository;\nuse Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Security;\n-use Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;\nuse Symfony\\Component\\Finder\\Finder;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\Routing\\Annotation\\Route;\n@@ -21,11 +21,8 @@ use Webmozart\\PathUtil\\Path;\n* @Route(\"/bolt\")\n* @Security(\"has_role('ROLE_ADMIN')\")\n*/\n-class FinderController extends AbstractController\n+class FinderController extends BaseController\n{\n- /** @var Config */\n- private $config;\n-\n/** @var Areas */\nprivate $areas;\n@@ -59,7 +56,7 @@ class FinderController extends AbstractController\n$parent = $path !== '/' ? Path::canonicalize($path . '/..') : '';\n- return $this->render('finder/finder.twig', [\n+ return $this->renderTemplate('finder/finder.twig', [\n'path' => $path,\n'name' => $area->get('name'),\n'area' => $area->get('key'),\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/Bolt/MediaController.php", "new_path": "src/Controller/Bolt/MediaController.php", "diff": "@@ -7,11 +7,10 @@ namespace Bolt\\Controller\\Bolt;\nuse Bolt\\Configuration\\Areas;\nuse Bolt\\Configuration\\Config;\nuse Bolt\\Content\\MediaFactory;\n+use Bolt\\Controller\\BaseController;\nuse Bolt\\Entity\\Media;\n-use Bolt\\Repository\\MediaRepository;\nuse Doctrine\\Common\\Persistence\\ObjectManager;\nuse Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Security;\n-use Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;\nuse Symfony\\Component\\Finder\\Finder;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\Routing\\Annotation\\Route;\n@@ -24,11 +23,8 @@ use Webmozart\\PathUtil\\Path;\n* @Route(\"/bolt\")\n* @Security(\"has_role('ROLE_ADMIN')\")\n*/\n-class MediaController extends AbstractController\n+class MediaController extends BaseController\n{\n- /** @var Config */\n- private $config;\n-\n/** @var ObjectManager */\nprivate $manager;\n@@ -42,9 +38,9 @@ class MediaController extends AbstractController\n* MediaController constructor.\n*\n* @param Config $config\n- * @param MediaRepository $mediaRepository\n* @param ObjectManager $manager\n* @param Areas $areas\n+ * @param MediaFactory $mediaFactory\n*/\npublic function __construct(Config $config, ObjectManager $manager, Areas $areas, MediaFactory $mediaFactory)\n{\n@@ -71,9 +67,7 @@ class MediaController extends AbstractController\n$this->manager->flush();\n}\n- dd($file);\n-\n- return $this->render('finder/finder.twig', [\n+ return $this->renderTemplate('finder/finder.twig', [\n'path' => $path,\n'name' => $areas[$area]['name'],\n'area' => $area,\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/Bolt/UserController.php", "new_path": "src/Controller/Bolt/UserController.php", "diff": "@@ -4,10 +4,10 @@ declare(strict_types=1);\nnamespace Bolt\\Controller\\Bolt;\n+use Bolt\\Controller\\BaseController;\nuse Bolt\\Form\\ChangePasswordType;\nuse Bolt\\Form\\UserType;\nuse Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Security;\n-use Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\Routing\\Annotation\\Route;\n@@ -19,7 +19,7 @@ use Symfony\\Component\\Security\\Core\\Encoder\\UserPasswordEncoderInterface;\n* @Route(\"/bolt\")\n* @Security(\"has_role('ROLE_ADMIN')\")\n*/\n-class UserController extends AbstractController\n+class UserController extends BaseController\n{\n/**\n* @Route(\"/profile-edit\", methods={\"GET\", \"POST\"}, name=\"bolt_profile_edit\")\n@@ -36,7 +36,7 @@ class UserController extends AbstractController\nreturn $this->redirectToRoute('bolt_profile_edit');\n}\n- return $this->render('users/edit.twig', [\n+ return $this->renderTemplate('users/edit.twig', [\n'user' => $user,\n'form' => $form->createView(),\n]);\n@@ -48,6 +48,10 @@ class UserController extends AbstractController\n* @param Request $request\n* @param UserPasswordEncoderInterface $encoder\n*\n+ * @throws \\Twig_Error_Loader\n+ * @throws \\Twig_Error_Runtime\n+ * @throws \\Twig_Error_Syntax\n+ *\n* @return Response\n*/\npublic function changePassword(Request $request, UserPasswordEncoderInterface $encoder): Response\n@@ -62,7 +66,7 @@ class UserController extends AbstractController\nreturn $this->redirectToRoute('security_logout');\n}\n- return $this->render('users/change_password.twig', [\n+ return $this->renderTemplate('users/change_password.twig', [\n'form' => $form->createView(),\n]);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/FrontendController.php", "new_path": "src/Controller/FrontendController.php", "diff": "@@ -4,32 +4,16 @@ declare(strict_types=1);\nnamespace Bolt\\Controller;\n-use Bolt\\Configuration\\Config;\nuse Bolt\\Content\\ContentTypeFactory;\nuse Bolt\\Entity\\Content;\nuse Bolt\\Repository\\ContentRepository;\nuse Bolt\\Repository\\FieldRepository;\n-use Bolt\\TemplateChooser;\n-use Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\Routing\\Annotation\\Route;\n-use Tightenco\\Collect\\Support\\Collection;\n-class FrontendController extends AbstractController\n+class FrontendController extends BaseController\n{\n- /** @var Config */\n- private $config;\n-\n- /** @var TemplateChooser */\n- private $templateChooser;\n-\n- public function __construct(Config $config, TemplateChooser $templateChooser)\n- {\n- $this->config = $config;\n- $this->templateChooser = $templateChooser;\n- }\n-\n/**\n* @Route(\"/\", methods={\"GET\"}, name=\"homepage\")\n*/\n@@ -105,53 +89,4 @@ class FrontendController extends AbstractController\nreturn $this->renderTemplate($templates, $context);\n}\n-\n- /**\n- * Shortcut for {@see \\Bolt\\Config::get}.\n- *\n- * @param string $path\n- * @param mixed $default\n- *\n- * @return string|int|array|null\n- */\n- protected function getOption($path, $default = null)\n- {\n- return $this->config->get($path, $default);\n- }\n-\n- /**\n- * Renders a view.\n- *\n- * @final\n- *\n- * @param Collection $templates\n- * @param array $parameters\n- * @param Response|null $response\n- *\n- * @throws \\Twig_Error_Loader\n- * @throws \\Twig_Error_Runtime\n- * @throws \\Twig_Error_Syntax\n- *\n- * @return Response\n- */\n- protected function renderTemplate(Collection $templates, array $parameters = [], Response $response = null): Response\n- {\n- /** @var \\Twig_Environment $twig */\n- $twig = $this->container->get('twig');\n-\n- $parameters['config'] = $this->config;\n-\n- // Resolve string|array of templates into the first one that is found.\n- $template = $twig->resolveTemplate($templates->toArray());\n-\n- $content = $twig->render($template, $parameters);\n-\n- if ($response === null) {\n- $response = new Response();\n- }\n-\n- $response->setContent($content);\n-\n- return $response;\n- }\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/SecurityController.php", "new_path": "src/Controller/SecurityController.php", "diff": "@@ -4,12 +4,11 @@ declare(strict_types=1);\nnamespace Bolt\\Controller;\n-use Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\Routing\\Annotation\\Route;\nuse Symfony\\Component\\Security\\Http\\Authentication\\AuthenticationUtils;\n-class SecurityController extends AbstractController\n+class SecurityController extends BaseController\n{\n/**\n* @Route(\"/bolt/login\", name=\"bolt_login\")\n@@ -22,7 +21,7 @@ class SecurityController extends AbstractController\n// last authentication error (if any)\n$error = $authenticationUtils->getLastAuthenticationError();\n- return $this->render('security/login.twig', [\n+ return $this->renderTemplate('security/login.twig', [\n'last_username' => $last_username,\n'error' => $error,\n]);\n" }, { "change_type": "MODIFY", "old_path": "src/DataFixtures/TaxonomyFixtures.php", "new_path": "src/DataFixtures/TaxonomyFixtures.php", "diff": "@@ -62,11 +62,9 @@ class TaxonomyFixtures extends Fixture implements DependentFixtureInterface\n;\n$manager->persist($taxonomy);\n- $reference = \"taxonomy_\" . $taxonomyDefinition['slug'] . \"_\" . $slugify->slugify($key);\n+ $reference = 'taxonomy_' . $taxonomyDefinition['slug'] . '_' . $slugify->slugify($key);\n$this->addReference($reference, $taxonomy);\n}\n-\n-\n}\n}\n@@ -88,5 +86,4 @@ class TaxonomyFixtures extends Fixture implements DependentFixtureInterface\n'videogames', 'war', 'web', 'women', 'world', 'writing', 'wtf', 'zombies',\n];\n}\n-\n}\n" } ]
PHP
MIT License
bolt/core
Adding a Basecontroller
95,144
17.10.2018 13:19:03
-7,200
fd00a4ca9f877fa1b922de82b72617fd7ef6a469
Working on file uploader
[ { "change_type": "MODIFY", "old_path": "src/Configuration/Config.php", "new_path": "src/Configuration/Config.php", "diff": "@@ -94,10 +94,11 @@ class Config\n/**\n* @param string $path\n* @param bool $absolute\n+ * @param mixed $additional\n*\n* @return string\n*/\n- public function getPath(string $path, bool $absolute = true, string $additional = ''): string\n+ public function getPath(string $path, bool $absolute = true, $additional = null): string\n{\nreturn $this->pathResolver->resolve($path, $absolute, $additional);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Configuration/PathResolver.php", "new_path": "src/Configuration/PathResolver.php", "diff": "@@ -4,6 +4,7 @@ declare(strict_types=1);\nnamespace Bolt\\Configuration;\n+use Exception;\nuse Tightenco\\Collect\\Support\\Collection;\nuse Webmozart\\PathUtil\\Path;\n@@ -94,10 +95,11 @@ class PathResolver\n*\n* @param string $path the path\n* @param bool $absolute if the path is relative, resolve it against the root path\n+ * @param mixed $additional\n*\n* @return string\n*/\n- public function resolve(string $path, bool $absolute = true, string $additional = ''): string\n+ public function resolve(string $path, bool $absolute = true, $additional = null): string\n{\nif (isset($this->paths[$path])) {\n$path = $this->paths[$path];\n@@ -129,8 +131,8 @@ class PathResolver\n$path = Path::makeAbsolute($path, $this->paths['root']);\n}\n- if ($additional !== '') {\n- $path .= '/' . $additional;\n+ if (!empty($additional)) {\n+ $path .= DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, (array) $additional);\n}\n// Make sure we don't have lingering unneeded dir-seperators\n" }, { "change_type": "MODIFY", "old_path": "src/Content/MediaFactory.php", "new_path": "src/Content/MediaFactory.php", "diff": "@@ -7,14 +7,19 @@ declare(strict_types=1);\nnamespace Bolt\\Content;\n+use Bolt\\Common\\Json;\nuse Bolt\\Configuration\\Config;\nuse Bolt\\Entity\\Media;\n+use Bolt\\Media\\Item;\nuse Bolt\\Repository\\MediaRepository;\nuse Carbon\\Carbon;\n+use Cocur\\Slugify\\Slugify;\nuse Faker\\Factory;\nuse PHPExif\\Reader\\Reader;\nuse Symfony\\Component\\DependencyInjection\\ContainerInterface;\n+use Symfony\\Component\\Filesystem\\Filesystem;\nuse Symfony\\Component\\Finder\\SplFileInfo;\n+use Webmozart\\PathUtil\\Path;\nclass MediaFactory\n{\n@@ -116,4 +121,55 @@ class MediaFactory\nreturn $user;\n}\n+\n+ /**\n+ * @param Item $item\n+ * @param $params\n+ * @return Media\n+ */\n+ public function createFromUpload(Item $item, $params): Media\n+ {\n+ if (Json::test($params)) {\n+ $params = Json::parse($params);\n+ $addedPath = $params['path'];\n+ $area = $params['area'];\n+ } else {\n+ $addedPath = '';\n+ $area = 'files';\n+ }\n+\n+ $targetFilename = $addedPath . DIRECTORY_SEPARATOR . $this->sanitiseFilename($item->getName());\n+\n+ $source = $this->config->getPath('cache', true, ['uploads', $item->getId(), $item->getName()]);\n+ $target = $this->config->getPath($area, true, $targetFilename);\n+\n+ $relPath = Path::getDirectory($targetFilename);\n+ $relName = Path::getFilename($targetFilename);\n+\n+ // Move the file over\n+ $fileSystem = new Filesystem();\n+ $fileSystem->rename($source, $target, true);\n+\n+ $file = new SplFileInfo($target, $relPath, $relName);\n+\n+ $media = $this->createOrUpdateMedia($file, $area);\n+\n+ return $media;\n+ }\n+\n+ /**\n+ * @param string $filename\n+ * @return string\n+ */\n+ private function sanitiseFilename(string $filename): string\n+ {\n+ $extensionSlug = new Slugify(['regexp' => '/([^a-z0-9]|-)+/']);\n+ $filenameSlug = new Slugify(['lowercase' => false]);\n+\n+ $extension = $extensionSlug->slugify(Path::getExtension($filename));\n+ $filename = $filenameSlug->slugify(Path::getFilenameWithoutExtension($filename));\n+\n+ return $filename . '.' . $extension;\n+ }\n+\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Controller/Async/Uploader.php", "diff": "+<?php\n+\n+namespace Bolt\\Controller\\Async;\n+\n+use Bolt\\Content\\MediaFactory;\n+use Bolt\\Media\\RequestHandler;\n+use Doctrine\\Common\\Persistence\\ObjectManager;\n+use Symfony\\Component\\HttpFoundation\\Request;\n+use Symfony\\Component\\HttpFoundation\\Response;\n+use Symfony\\Component\\Routing\\Annotation\\Route;\n+\n+class Uploader\n+{\n+ /** @var MediaFactory*/\n+ private $mediaFactory;\n+\n+ /** @var RequestHandler */\n+ private $requestHandler;\n+\n+ /** @var ObjectManager */\n+ private $manager;\n+\n+ public function __construct(MediaFactory $mediaFactory, RequestHandler $requestHandler, ObjectManager $manager)\n+ {\n+ $this->mediaFactory = $mediaFactory;\n+ $this->requestHandler = $requestHandler;\n+ $this->manager = $manager;\n+ }\n+\n+ /**\n+ *\n+ * @Route(\"/async/upload\", name=\"bolt_upload_post\", methods={\"POST\"})\n+ *\n+ */\n+ public function upload(Request $request)\n+ {\n+ // Get submitted field data item, will always be one item in case of async upload\n+ $items = $this->requestHandler->loadFilesByField('filepond');\n+\n+ // If no items, exit\n+ if (count($items) === 0) {\n+ // Something went wrong, most likely a field name mismatch\n+ http_response_code(400);\n+ return;\n+ }\n+\n+ $params = $request->request->get('filepond', []);\n+\n+ foreach($items as $item) {\n+ $media = $this->mediaFactory->createFromUpload($item, current($params));\n+ dump($media);\n+\n+ $this->manager->persist($media);\n+ $this->manager->flush();\n+ }\n+\n+ // Returns plain text content\n+ header('Content-Type: text/plain');\n+\n+ // Remove item from array Response contains uploaded file server id\n+ echo array_shift($items)->getId();\n+\n+ return new Response(\"Finis!\");\n+ }\n+}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/Bolt/EditRecordController.php", "new_path": "src/Controller/Bolt/EditRecordController.php", "diff": "@@ -42,6 +42,9 @@ class EditRecordController extends BaseController\n* @param Content|null $content\n*\n* @return Response\n+ * @throws \\Twig_Error_Loader\n+ * @throws \\Twig_Error_Runtime\n+ * @throws \\Twig_Error_Syntax\n*/\npublic function edit(string $id, Request $request, Content $content = null): Response\n{\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Media/Item.php", "diff": "+<?php\n+\n+namespace Bolt\\Media;\n+\n+/**\n+ * A wrapper class for easier access to $_FILES object\n+ */\n+\n+class Item {\n+\n+ // counter that helps in ensuring each file receives a truly unique id\n+ public static $item_counter = 0;\n+\n+ // item props\n+ private $id;\n+ private $file;\n+ private $name;\n+\n+ public function __construct($file, $id = null) {\n+ $this->id = isset($id) ? $id : md5( uniqid(self::$item_counter++, true) );\n+ $this->file = $file;\n+ $this->name = $file['name'];\n+ }\n+\n+ public function rename($name, $extension = null) {\n+ $info = pathinfo($this->name);\n+ $this->name = $name . '.' . ( isset($extension) ? $extension : $info['extension'] );\n+ }\n+\n+ public function getId() {\n+ return $this->id;\n+ }\n+\n+ public function getFilename() {\n+ return $this->file['tmp_name'];\n+ }\n+\n+ public function getName() {\n+ return basename($this->name);\n+ }\n+\n+ public function getNameWithoutExtension() {\n+ $info = pathinfo($this->name);\n+ return $info['filename'];\n+ }\n+\n+ public function getExtension() {\n+ $info = pathinfo($this->name);\n+ return $info['extension'];\n+ }\n+\n+ public function getSize() {\n+ return $this->file['size'];\n+ }\n+\n+ public function getType() {\n+ return $this->file['mime'];\n+ }\n+}\n+\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Media/RequestHandler.php", "diff": "+<?php\n+\n+namespace Bolt\\Media;\n+\n+use Bolt\\Configuration\\Config;\n+\n+/**\n+ * FilePond RequestHandler helper class\n+ */\n+\n+/*\n+1. get files (from $files and $post)\n+2. store files in tmp/ directory and give them a unique server id\n+3. return server id's to client\n+4. either client reverts upload or finalizes form\n+5. call revert($server_id) to remove file from tmp/ directory\n+6. call save() to save file to final directory\n+*/\n+class RequestHandler\n+{\n+ // the default location to save tmp files to\n+ private $tmp_dir;\n+\n+ // regex to use for testing if a string is a file id\n+ private $file_id_format = '/^[0-9a-fA-F]{32}$/';\n+\n+ /** @var Config */\n+ private $config;\n+\n+ public function __construct(Config $config)\n+ {\n+ $this->config = $config;\n+\n+ $this->tmp_dir = $this->config->getPath('cache', true, ['uploads']);\n+ }\n+\n+\n+ /**\n+ * @param $str\n+ * @return bool\n+ */\n+ public function isFileId($str) {\n+ return preg_match($this->file_id_format, $str);\n+ }\n+\n+ /**\n+ * @param $str\n+ * @return bool\n+ */\n+ public function isURL($str) {\n+ return filter_var($str, FILTER_VALIDATE_URL);\n+ }\n+\n+ /**\n+ * Catch all exceptions so we can return a 500 error when the server bugs out\n+ */\n+ public function catchExceptions() {\n+ set_exception_handler('FilePond\\RequestHandler::handleException');\n+ }\n+\n+ public function handleException($ex) {\n+\n+ // write to error log so we can still find out what's up\n+ error_log('Uncaught exception in class=\"' . get_class($ex) . '\" message=\"' . $ex->getMessage() . '\" line=\"' . $ex->getLine() . '\"');\n+\n+ // clean up buffer\n+ ob_end_clean();\n+\n+ // server error mode go!\n+ http_response_code(500);\n+ }\n+\n+ private function createItem($file, $id = null) {\n+ return new Item($file, $id);\n+ }\n+\n+ /**\n+ * @param $fieldName\n+ * @return array\n+ */\n+ public function loadFilesByField($fieldName) {\n+\n+ // See if files are posted as JSON string (each file being base64 encoded)\n+ $base64Items = $this->loadBase64FormattedFiles($fieldName);\n+\n+ // retrieves posted file objects\n+ $fileItems = $this->loadFileObjects($fieldName);\n+\n+ // retrieves files already on server\n+ $tmpItems = $this->loadFilesFromTemp($fieldName);\n+\n+ // save newly received files to temp files folder (tmp items already are in that folder)\n+ $this->saveAsTempFiles(array_merge($base64Items, $fileItems));\n+\n+ // return items\n+ return array_merge($base64Items, $fileItems, $tmpItems);\n+ }\n+\n+ private function loadFileObjects($fieldName) {\n+\n+ $items = [];\n+\n+ if ( !isset($_FILES[$fieldName]) ) {\n+ return $items;\n+ }\n+\n+ $FILE = $_FILES[$fieldName];\n+\n+ if (is_array($FILE['tmp_name'])) {\n+\n+ foreach( $FILE['tmp_name'] as $index => $tmpName ) {\n+\n+ array_push( $items, $this->createItem( array(\n+ 'tmp_name' => $FILE['tmp_name'][$index],\n+ 'name' => $FILE['name'][$index],\n+ 'size' => $FILE['size'][$index],\n+ 'error' => $FILE['error'][$index],\n+ 'type' => $FILE['type'][$index]\n+ )) );\n+\n+ }\n+\n+ }\n+ else {\n+ array_push( $items, $this->createItem($FILE) );\n+ }\n+\n+ return $items;\n+ }\n+\n+ private function loadBase64FormattedFiles($fieldName) {\n+\n+ /*\n+ // format:\n+ {\n+ \"id\": \"iuhv2cpsu\",\n+ \"name\": \"picture.jpg\",\n+ \"type\": \"image/jpeg\",\n+ \"size\": 20636,\n+ \"metadata\" : {...}\n+ \"data\": \"/9j/4AAQSkZJRgABAQEASABIAA...\"\n+ }\n+ */\n+\n+ $items = [];\n+\n+ if ( !isset($_POST[$fieldName] ) ) {\n+ return $items;\n+ }\n+\n+ // Handle posted files array\n+ $values = $_POST[$fieldName];\n+\n+ // Turn values in array if is submitted as single value\n+ if (!is_array($values)) {\n+ $values = isset($values) ? array($values) : array();\n+ }\n+\n+ // If files are found, turn base64 strings into actual file objects\n+ foreach ($values as $value) {\n+\n+ // suppress error messages, we'll just investigate the object later\n+ $obj = @json_decode($value);\n+\n+ // skip values that failed to be decoded\n+ if (!isset($obj)) {\n+ continue;\n+ }\n+\n+ // test if this is a file object (matches the object described above)\n+ if (!$this->isEncodedFile($obj)) {\n+ continue;\n+ }\n+\n+ array_push($items, $this->createItem( $this->createTempFile($obj) ) );\n+ }\n+\n+ return $items;\n+ }\n+\n+ private function isEncodedFile($obj) {\n+ return isset($obj->id) && isset($obj->data) && isset($obj->name) && isset($obj->type) && isset($obj->size);\n+ }\n+\n+ private function loadFilesFromTemp($fieldName) {\n+\n+ $items = [];\n+\n+ if ( !isset($_POST[$fieldName] ) ) {\n+ return $items;\n+ }\n+\n+ // Handle posted ids array\n+ $values = $_POST[$fieldName];\n+\n+ // Turn values in array if is submitted as single value\n+ if (!is_array($values)) {\n+ $values = isset($values) ? array($values) : array();\n+ }\n+\n+ // test if value is actually a file id\n+ foreach ($values as $value) {\n+ if ( $this->isFileId($value) ) {\n+ array_push($items, $this->createItem($this->getTempFile($value), $value));\n+ }\n+ }\n+\n+ return $items;\n+\n+ }\n+\n+ public function save($items, $path = 'uploads' . DIRECTORY_SEPARATOR) {\n+\n+ // is list of files\n+ if ( is_array($items) ) {\n+ $results = [];\n+ foreach($items as $item) {\n+ array_push($results, $this->saveFile($item, $path));\n+ }\n+ return $results;\n+ }\n+\n+ // is single item\n+ return $this->saveFile($items, $path);\n+ }\n+\n+ /**\n+ * @param $file_id\n+ * @return bool\n+ */\n+ public function deleteTempFile($file_id) {\n+ return $this->deleteTempDirectory($file_id);\n+ }\n+\n+ /**\n+ * @param $url\n+ * @return array|bool\n+ */\n+ public function getRemoteURLData($url)\n+ {\n+ try {\n+ $ch = curl_init();\n+ curl_setopt($ch, CURLOPT_URL, $url);\n+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n+\n+ $content = curl_exec($ch);\n+ if ($content === FALSE) {\n+ throw new Exception(curl_error($ch), curl_errno($ch));\n+ }\n+\n+ $type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);\n+ $length = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD);\n+ $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n+\n+ curl_close ($ch);\n+\n+ $success = $code >= 200 && $code < 300;\n+\n+ return array(\n+ 'code' => $code,\n+ 'content' => $content,\n+ 'type' => $type,\n+ 'length' => $length,\n+ 'success' => $success\n+ );\n+\n+ }\n+ catch(Exception $e) {\n+ return null;\n+ }\n+ }\n+\n+ private function saveAsTempFiles($items) {\n+ foreach($items as $item) {\n+ $this->saveTempFile($item);\n+ }\n+ }\n+\n+ private function saveTempFile($file) {\n+\n+ // make sure path name is safe\n+ $path = $this->getSecureTempPath() . $file->getId() . DIRECTORY_SEPARATOR;\n+\n+ // Creates a secure temporary directory to store the files in\n+ $this->createSecureDirectory($path);\n+\n+ // get source and target values\n+ $source = $file->getFilename();\n+ $target = $path . $file->getName();\n+\n+ // Move uploaded file to this new secure directory\n+ $result = $this->moveFile($source, $target);\n+\n+ // Was not saved\n+ if ($result !== true) { return $result; }\n+\n+ // Make sure file is secure\n+ $this->setSecureFilePermissions($target);\n+\n+ // temp file stored successfully\n+ return true;\n+ }\n+\n+ public function getTempFile($fileId) {\n+\n+ // select all files in directory except .htaccess\n+ foreach(glob($this->getSecureTempPath() . $fileId . DIRECTORY_SEPARATOR . '*.*') as $file) {\n+\n+ try {\n+\n+ $handle = fopen($file, 'r');\n+ $content = fread($handle, filesize($file));\n+ fclose($handle);\n+\n+ return array(\n+ 'name' => basename($file),\n+ 'content' => $content,\n+ 'type' => mime_content_type($file),\n+ 'length' => filesize($file)\n+ );\n+\n+ }\n+ catch(Exception $e) {\n+ return null;\n+ }\n+ }\n+\n+ return false;\n+ }\n+\n+ public function getFile($file, $path) {\n+\n+ try {\n+\n+ $filename = $path . DIRECTORY_SEPARATOR . $file;\n+ $handle = fopen($filename, 'r');\n+ $content = fread($handle, filesize($filename));\n+ fclose($handle);\n+\n+ return array(\n+ 'name' => basename($filename),\n+ 'content' => $content,\n+ 'type' => mime_content_type($filename),\n+ 'length' => filesize($filename)\n+ );\n+\n+ }\n+ catch(Exception $e) {\n+ return null;\n+ }\n+\n+ }\n+\n+ private function saveFile($item, $path) {\n+\n+ // nope\n+ if (!isset($item)) {\n+ return false;\n+ }\n+\n+ // if is file id\n+ if (is_string($item)) {\n+ return $this->moveFileById($item, $path);\n+ }\n+\n+ // is file object\n+ else {\n+ return $this->moveFileById($item->getId(), $path, $item->getName());\n+ }\n+\n+ }\n+\n+ private function moveFileById($fileId, $path, $fileName = null) {\n+\n+ // select all files in directory except .htaccess\n+ foreach(glob($this->getSecureTempPath() . $fileId . DIRECTORY_SEPARATOR . '*.*') as $file) {\n+\n+ $source = $file;\n+ $target = $this->getSecurePath($path);\n+\n+ $this->createDirectory($target);\n+\n+ rename($source, $target . (isset($fileName) ? basename($fileName) : basename($file)));\n+ }\n+\n+ // remove directory\n+ $this->deleteTempDirectory($fileId);\n+\n+ // done!\n+ return true;\n+ }\n+\n+ private function deleteTempDirectory($id) {\n+\n+ @array_map('unlink', glob($this->getSecureTempPath() . $id . DIRECTORY_SEPARATOR . '{.,}*', GLOB_BRACE));\n+\n+ // remove temp directory\n+ @rmdir($this->getSecureTempPath() . $id);\n+\n+ }\n+\n+ private function createTempFile($file) {\n+\n+ $tmp = tmpfile();\n+ fwrite($tmp, base64_decode($file->data));\n+ $meta = stream_get_meta_data($tmp);\n+ $filename = $meta['uri'];\n+\n+ return array(\n+ 'error' => 0,\n+ 'size' => filesize($filename),\n+ 'type' => $file->type,\n+ 'name' => $file->name,\n+ 'tmp_name' => $filename,\n+ 'tmp' => $tmp\n+ );\n+\n+ }\n+\n+ private function moveFile($source, $target) {\n+\n+ if (is_uploaded_file($source)) {\n+ return move_uploaded_file($source, $target);\n+ }\n+ else {\n+ $tmp = fopen($source, 'r');\n+ $result = file_put_contents( $target, fread($tmp, filesize($source) ) );\n+ fclose($tmp);\n+ return $result;\n+ }\n+\n+ }\n+\n+ private function getSecurePath($path) {\n+ return pathinfo($path)['dirname'] . DIRECTORY_SEPARATOR . basename($path) . DIRECTORY_SEPARATOR;\n+ }\n+\n+ private function getSecureTempPath() {\n+ return $this->getSecurePath($this->tmp_dir);\n+ }\n+\n+ private function setSecureFilePermissions($target) {\n+ $stat = stat( dirname($target) );\n+ $perms = $stat['mode'] & 0000666;\n+ @chmod($target, $perms);\n+ }\n+\n+ private function createDirectory($path) {\n+ if (is_dir($path)) {\n+ return false;\n+ }\n+ mkdir($path, 0755, true);\n+ return true;\n+ }\n+\n+ private function createSecureDirectory($path) {\n+\n+ // !! If directory already exists we assume security is handled !!\n+\n+ // Test if directory already exists and correct\n+ if ($this->createDirectory($path)) {\n+\n+ // Add .htaccess file for security purposes\n+ $content = '# Don\\'t list directory contents\n+IndexIgnore *\n+# Disable script execution\n+AddHandler cgi-script .php .pl .jsp .asp .sh .cgi\n+Options -ExecCGI -Indexes';\n+ file_put_contents($path . '.htaccess', $content);\n+\n+ }\n+\n+ }\n+\n+}\n+\n+\n" }, { "change_type": "MODIFY", "old_path": "templates/finder/_files.twig", "new_path": "templates/finder/_files.twig", "diff": "{% set dimensions = '' %}\n{% if extension in imageformats %}\n- {% set thumbnail = filename|thumbnail(100, 72) %}\n+ {% set thumbnail = filename|thumbnail(width = 100, height = 72, area = area) %}\n{% set icon = 'fa-image' %}\n{% set link = path('bolt_media_new', {'area': area, 'file': filename}) %}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "templates/finder/_uploader.twig", "diff": "+<link rel=\"stylesheet\" href=\"https://unpkg.com/filepond/dist/filepond.min.css\">\n+<link rel=\"stylesheet\" href=\"https://unpkg.com/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.min.css\">\n+\n+<script src=\"https://unpkg.com/filepond-plugin-image-preview\"></script>\n+<script src=\"https://unpkg.com/filepond-plugin-file-metadata/dist/filepond-plugin-file-metadata.js\"></script>\n+<script src=\"https://unpkg.com/filepond\"></script>\n+<script src=\"https://unpkg.com/vue\"></script>\n+<script src=\"https://unpkg.com/vue-filepond\"></script>\n+\n+<div class=\"card mb-4\">\n+ <div class=\"card-header\">File uploader</div>\n+ <div id=\"uploader\">\n+ <file-pond name=\"filepond[]\"\n+ ref=\"pond\"\n+ allow-multiple=\"true\"\n+ accepted-file-types=\"image/jpeg, image/png\"\n+ server=\"/async/upload\"></file-pond>\n+ </div>\n+</div>\n+\n+\n+<script>\n+ FilePond.registerPlugin(\n+ FilePondPluginFileMetadata,\n+ FilePondPluginImagePreview\n+ );\n+ FilePond.setOptions({\n+ fileMetadataObject: {\n+ 'area': '{{ area }}',\n+ 'path': '{{ path }}'\n+ }\n+ });\n+\n+ new Vue({\n+ el: '#uploader',\n+ components: {\n+ FilePond: vueFilePond.default()\n+ }\n+ });\n+</script>\n" }, { "change_type": "MODIFY", "old_path": "templates/finder/finder.twig", "new_path": "templates/finder/finder.twig", "diff": "{% block aside %}\n-<div class=\"card\">\n+<div class=\"card mb-4\">\n<div class=\"card-header\">Meta information</div>\n<div class=\"card-body\">\n</div>\n</div>\n+ {% include '@bolt/finder/_uploader.twig' %}\n+\n+\n{% endblock aside %}\n{{ parent() }}\n<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.6/css/selectize.min.css\" integrity=\"sha256-EhmqrzYSImS7269rfDxk4H+AHDyu/KwV1d8FDgIXScI=\" crossorigin=\"anonymous\" />\n+ <style>\n+ .filepond--root {\n+ margin-bottom: 0 !important;\n+ }\n+ </style>\n{% endblock %}\n" } ]
PHP
MIT License
bolt/core
Working on file uploader
95,144
17.10.2018 16:48:43
-7,200
761467dcbba56d72063dd4b68ff1f15f14de2ad4
Bit of a sidetrack: Made JS for slug field work.
[ { "change_type": "ADD", "old_path": null, "new_path": "templates/editcontent/javascripts/slug.twig", "diff": "+{% extends '@bolt/editcontent/javascripts/_base.twig' %}\n+\n+{% block javascripts %}\n+<script>\n+ var input = document.querySelector(\"input[name=\\\"{{ name }}\\\"]\");\n+ var slugTick;\n+ var element = document.querySelector('#{{ id }}-dropdown');\n+\n+ element.addEventListener('click', function (event) {\n+ if (action = event.target.getAttribute('data-action')) {\n+ var target = event.target;\n+ } else if (action = event.target.parentElement.getAttribute('data-action')) {\n+ var target = event.target.parentElement;\n+ } else {\n+ return;\n+ }\n+\n+ document.querySelector('#{{ id }}-dropdown button').innerHTML = target.innerHTML;\n+\n+ clearTimeout(slugTick);\n+\n+ if (action == 'lock') {\n+ input.readOnly = true;\n+ }\n+ if (action == 'generate') {\n+ input.readOnly = true;\n+\n+ var fromfields = [\"{{ field.slugUseFields|join(\"', '\") }}\"];\n+ updateSlug(fromfields, input);\n+ }\n+ if (action == 'edit') {\n+ input.readOnly = false;\n+ input.select();\n+ }\n+\n+ }, false);\n+\n+ function updateSlug(fromfields, input) {\n+ var newSlug = '';\n+ fromfields.forEach(function (field) {\n+ newSlug = newSlug + document.querySelector(\"input[name=\\\"fields[\" + field + \"]\\\"]\").value;\n+ });\n+ input.value = slugify(newSlug);\n+ slugTick = setTimeout(function() {\n+ updateSlug(fromfields, input);\n+ }, 400);\n+ }\n+\n+ function slugify(text)\n+ {\n+ return text.toString().toLowerCase()\n+ .replace(/\\s+/g, '-') // Replace spaces with -\n+ .replace(/[^\\w\\-]+/g, '') // Remove all non-word chars\n+ .replace(/\\-\\-+/g, '-') // Replace multiple - with single -\n+ .replace(/^-+/, '') // Trim - from start of text\n+ .replace(/-+$/, ''); // Trim - from end of text\n+ }\n+\n+ // If slug is empty, \"click\" the 'generate from' option.\n+ if (input.value == '') {\n+ document.querySelector(\"a[data-action=\\\"generate\\\"]\").click();\n+ }\n+</script>\n+{% endblock %}\n\\ No newline at end of file\n" } ]
PHP
MIT License
bolt/core
Bit of a sidetrack: Made JS for slug field work.
95,144
17.10.2018 22:15:57
-7,200
0ba0c16b890144e79ec344f9b23d3a144088276f
Working on uploaders.
[ { "change_type": "MODIFY", "old_path": "assets/js/bolt.js", "new_path": "assets/js/bolt.js", "diff": "@@ -43,4 +43,6 @@ $(document).ready(function() {\n// $(\".ui.calendar\").calendar({\n// ampm: false\n// });\n+\n+ var lightbox = $('a.lightbox').simpleLightbox();\n});\n" }, { "change_type": "MODIFY", "old_path": "assets/scss/_bootstrap-overrides.scss", "new_path": "assets/scss/_bootstrap-overrides.scss", "diff": "font-size: 0.9rem;\n}\n}\n+\n+\n+.sl-overlay {\n+ background: #000;\n+ opacity: 0.85;\n+}\n+\n+.sl-close {\n+ color: #FFF;\n+}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "config/bolt/contenttypes.yml", "new_path": "config/bolt/contenttypes.yml", "diff": "@@ -261,41 +261,40 @@ blocks:\nslug:\ntype: slug\nuses: [ title ]\n- selectfield:\n- type: select\n- values: [ foo, bar, baz ]\n- selectfieldd:\n- type: select\n- values:\n- foo: \"Fooo\"\n- bar: Bario\n- baz: Bazz\n- multiselect:\n- type: select\n- values: [ A-tuin, Donatello, Rafael, Leonardo, Michelangelo, Koopa, Squirtle ]\n- multiple: false\n- postfix: \"Select your favourite turtle(s).\"\n- multiselect2:\n- type: select\n- values: [ A-tuin, Donatello, Rafael, Leonardo, Michelangelo, Koopa, Squirtle ]\n- multiple: true\n- required: true\n- postfix: \"Select your favourite turtle(s).\"\n-\n-\n-# content:\n-# type: html\n-# height: 150px\n-# contentlink:\n-# type: text\n-# label: Link\n-# placeholder: 'contenttype/slug or http://example.org/'\n-# postfix: \"Use this to add a link for this Block. This could either be an 'internal' link like <tt>page/about</tt>, if you use a contenttype/slug combination. Otherwise use a proper URL, like `http://example.org`.\"\n-# image:\n-# type: image\n-# attrib: title\n-# extensions: [ gif, jpg, png ]\n+# selectfield:\n+# type: select\n+# values: [ foo, bar, baz ]\n+# selectfieldd:\n+# type: select\n+# values:\n+# foo: \"Fooo\"\n+# bar: Bario\n+# baz: Bazz\n+# multiselect:\n+# type: select\n+# values: [ A-tuin, Donatello, Rafael, Leonardo, Michelangelo, Koopa, Squirtle ]\n+# multiple: false\n+# postfix: \"Select your favourite turtle(s).\"\n+#\n+# multiselect2:\n+# type: select\n+# values: [ A-tuin, Donatello, Rafael, Leonardo, Michelangelo, Koopa, Squirtle ]\n+# multiple: true\n+# required: true\n+# postfix: \"Select your favourite turtle(s).\"\n+ content:\n+ type: html\n+ height: 150px\n+ contentlink:\n+ type: text\n+ label: Link\n+ placeholder: 'contenttype/slug or http://example.org/'\n+ postfix: \"Use this to add a link for this Block. This could either be an 'internal' link like <tt>page/about</tt>, if you use a contenttype/slug combination. Otherwise use a proper URL, like `http://example.org`.\"\n+ image:\n+ type: image\n+ attrib: title\n+ extensions: [ gif, jpg, png ]\nshow_on_dashboard: true\nviewless: true\ndefault_status: published\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/Async/Uploader.php", "new_path": "src/Controller/Async/Uploader.php", "diff": "@@ -48,18 +48,10 @@ class Uploader\nforeach($items as $item) {\n$media = $this->mediaFactory->createFromUpload($item, current($params));\n- dump($media);\n-\n$this->manager->persist($media);\n$this->manager->flush();\n}\n- // Returns plain text content\n- header('Content-Type: text/plain');\n-\n- // Remove item from array Response contains uploaded file server id\n- echo array_shift($items)->getId();\n-\n- return new Response(\"Finis!\");\n+ return new Response($media->getPath() . $media->getFilename());\n}\n}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "templates/_base/layout.twig", "new_path": "templates/_base/layout.twig", "diff": "<link href=\"https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700\" rel=\"stylesheet\">\n<link rel=\"stylesheet\" href=\"https://use.fontawesome.com/releases/v5.3.1/css/all.css\" integrity=\"sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU\" crossorigin=\"anonymous\">\n<link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css\" integrity=\"sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO\" crossorigin=\"anonymous\">\n+ <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/simplelightbox/1.14.0/simplelightbox.min.css\" integrity=\"sha256-SKS4FkcNkeoVSuM7plVb7urk85SbYbpu13eMQa0XgcA=\" crossorigin=\"anonymous\" />\n<link rel=\"stylesheet\" type=\"text/css\" href=\"{{ asset('assets/bolt.css') }}\">\n{% endblock %}\n</head>\n<script src=\"{{ asset('assets/bolt.js') }}\"></script>\n<script src=\"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js\" integrity=\"sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49\" crossorigin=\"anonymous\"></script>\n<script src=\"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js\" integrity=\"sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy\" crossorigin=\"anonymous\"></script>\n+ <script src=\"https://cdnjs.cloudflare.com/ajax/libs/simplelightbox/1.14.0/simple-lightbox.min.js\" integrity=\"sha256-QKuCZaHT3kehJCIS5bXUrC6ciUWfswFF7ylYYPWQ/9w=\" crossorigin=\"anonymous\"></script>\n{% endblock %}\n</body>\n" }, { "change_type": "MODIFY", "old_path": "templates/editcontent/fields/image.twig", "new_path": "templates/editcontent/fields/image.twig", "diff": "{% block field %}\n<label>{{ label }}</label>\n- <div class=\"inline field\">\n+ <div class=\"row\" style=\"margin-right: 0;\">\n+ <div class=\"col-8\">\n+\n+ <div class=\"row mb-2\">\n+ <div class=\"col-3\">\n<label>Filename</label>\n- <input name=\"{{ name }}[filename]\" placeholder=\"First Name\" type=\"text\" value=\"{{ field.get('filename') }}\" class=\"{{ class }}\" {{ attributes|default()|raw }}>\n</div>\n- <div class=\"inline field\">\n+ <div class=\"col-9\">\n+ <input name=\"{{ name }}[filename]\" id=\"{{ id }}-filename\" placeholder=\"filename.jpg\" type=\"text\" value=\"{{ field.get('filename') }}\" class=\"{{ class }}\" {{ attributes|default()|raw }}>\n+ </div>\n+\n+ </div>\n+\n+ <div class=\"row mb-2\">\n+ <div class=\"col-3\">\n<label>Alt</label>\n- <input name=\"{{ name }}[alt]\" placeholder=\"First Name\" type=\"text\" value=\"{{ field.get('alt') }}\" class=\"{{ class }}\" {{ attributes|default()|raw }}>\n</div>\n- <hr>\n+ <div class=\"col-9\">\n+ <input name=\"{{ name }}[alt]\" placeholder=\"An image depicting a kitten\" type=\"text\" value=\"{{ field.get('alt') }}\" class=\"{{ class }}\" {{ attributes|default()|raw }}>\n+ </div>\n+ </div>\n+\n+ <div class=\"row mb-2\">\n+ <div class=\"col-3\">\n+ <label>Title</label>\n+ </div>\n+ <div class=\"col-9\">\n+ <input name=\"{{ name }}[alt]\" placeholder=\"A description of this image\" type=\"text\" value=\"{{ field.get('title') }}\" class=\"{{ class }}\" {{ attributes|default()|raw }}>\n+ </div>\n+ </div>\n+\n+ <div class=\"row mb-2\">\n+ <div class=\"col-12\" style=\"text-align: right;\">\n+ <a href=\"{{ field.get('filename')|thumbnail(width=500, height=500, area='files') }}\" class=\"btn btn-secondary btn-small lightbox\" style=\"color: #FFF;\">view image</a>\n+ <a href=\"\" onclick=\"document.querySelector('.filepond--drop-label label').click(); return false;\" class=\"btn btn-secondary btn-small\" style=\"color: #FFF;\">Upload an image</a>\n+ </div>\n+ </div>\n+\n+ </div>\n+ <div class=\"col-4\" id=\"{{ id }}-uploader\" style=\"padding: 0; min-height: 180px;\">\n+ <file-pond name=\"filepond[]\" ref=\"pond\" accepted-file-types=\"image/jpeg, image/png\" server=\"/async/upload\"></file-pond>\n+ </div>\n+\n+ </div>\n+\n+ <style>\n+ #{{ id }}-uploader {\n+ background-image: url({{ field.get('filename')|thumbnail(width=400, height=300, area='files') }});\n+ background-repeat: no-repeat;\n+ background-size: cover;\n+ }\n+ .filepond--root {\n+ margin: 0;\n+ }\n+ </style>\n{% endblock %}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "templates/editcontent/javascripts/image.twig", "diff": "+{% extends '@bolt/editcontent/javascripts/_base.twig' %}\n+\n+\n+{% block javascripts %}\n+ <script>\n+ FilePond.registerPlugin(\n+ FilePondPluginFileMetadata,\n+ FilePondPluginImagePreview\n+ );\n+ FilePond.setOptions({\n+ fileMetadataObject: {\n+ 'area': 'files',\n+ 'path': ''\n+ }\n+ });\n+\n+ new Vue({\n+ el: '#{{ id}}-uploader',\n+ components: {\n+ FilePond: vueFilePond.default()\n+ }\n+ });\n+\n+ const pond = document.querySelector('.filepond--root');\n+ pond.addEventListener('FilePond:processfile', e => {\n+ document.querySelector(\"#{{ id }}-filename\").value = e.detail.file.serverId;\n+ });\n+ pond.addEventListener('FilePond:addfile', e => {\n+ document.querySelector('.filepond--wrapper').style.opacity = \"0.5 !important\";\n+ console.log('foooo');\n+ document.querySelector(\"#{{ id }}-uploader\").style.background = 'none';\n+ });\n+\n+ </script>\n+{% endblock %}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "templates/editcontent/javascripts/image_include.twig", "diff": "+<script src=\"https://unpkg.com/filepond-plugin-image-preview\"></script>\n+<script src=\"https://unpkg.com/filepond-plugin-file-metadata/dist/filepond-plugin-file-metadata.js\"></script>\n+<script src=\"https://unpkg.com/filepond\"></script>\n+<script src=\"https://unpkg.com/vue\"></script>\n+<script src=\"https://unpkg.com/vue-filepond\"></script>\n" }, { "change_type": "ADD", "old_path": null, "new_path": "templates/editcontent/stylesheets/image_include.twig", "diff": "+<link rel=\"stylesheet\" href=\"https://unpkg.com/filepond/dist/filepond.min.css\">\n+<link rel=\"stylesheet\" href=\"https://unpkg.com/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.min.css\">\n" } ]
PHP
MIT License
bolt/core
Working on uploaders.
95,144
17.10.2018 22:21:18
-7,200
a4ca721bdc2e2ed09f6b94595402bba89785d417
Tweaking lightbox
[ { "change_type": "MODIFY", "old_path": "templates/editcontent/fields/image.twig", "new_path": "templates/editcontent/fields/image.twig", "diff": "<div class=\"row mb-2\">\n<div class=\"col-12\" style=\"text-align: right;\">\n- <a href=\"{{ field.get('filename')|thumbnail(width=500, height=500, area='files') }}\" class=\"btn btn-secondary btn-small lightbox\" style=\"color: #FFF;\">view image</a>\n+ <a href=\"{{ field.get('filename')|thumbnail(width=1000, height=1000, area='files') }}\" class=\"btn btn-secondary btn-small lightbox\" style=\"color: #FFF;\">view image</a>\n<a href=\"\" onclick=\"document.querySelector('.filepond--drop-label label').click(); return false;\" class=\"btn btn-secondary btn-small\" style=\"color: #FFF;\">Upload an image</a>\n</div>\n</div>\n" }, { "change_type": "MODIFY", "old_path": "templates/finder/_files.twig", "new_path": "templates/finder/_files.twig", "diff": "</td>\n<td class=\"listing-thumb\" style=\"padding: 0.2em;\">\n{%- if thumbnail -%}\n+ <a href=\"{{ filename|thumbnail(width = 1000, height = 1000, area=area) }}\" class=\"lightbox\">\n<img src=\"{{ thumbnail }}\" width=\"100\" height=\"72\">\n+ </a>\n{%- else -%}\n&nbsp;\n{%- endif -%}\n" } ]
PHP
MIT License
bolt/core
Tweaking lightbox
95,180
18.10.2018 20:40:13
-7,200
7c14ec8e65ab546d4f36e97699a325b0a065761e
added vscode to gitignore
[ { "change_type": "MODIFY", "old_path": ".gitignore", "new_path": ".gitignore", "diff": "@@ -39,3 +39,10 @@ yarn-error.log\n/.php_cs\n/.php_cs.cache\n###< friendsofphp/php-cs-fixer ###\n+\n+### VisualStudioCode ###\n+.vscode/*\n+!.vscode/settings.json\n+!.vscode/tasks.json\n+!.vscode/launch.json\n+!.vscode/extensions.json\n\\ No newline at end of file\n" } ]
PHP
MIT License
bolt/core
added vscode to gitignore
95,180
19.10.2018 10:46:59
-7,200
e8ca75d7ec99143a45badf711941238e30009d77
removed tinymce from webpack
[ { "change_type": "MODIFY", "old_path": "webpack.config.js", "new_path": "webpack.config.js", "diff": "@@ -31,27 +31,6 @@ Encore\n;\n-const config = {\n- module: {\n- loaders: [\n- {\n- test: require.resolve('tinymce/tinymce'),\n- loaders: [\n- 'imports?this=>window',\n- 'exports?window.tinymce'\n- ]\n- },\n- {\n- test: /tinymce\\/(themes|plugins)\\//,\n- loaders: [\n- 'imports?this=>window'\n- ]\n- }\n- ]\n- }\n- }\n-\n-\n// export the final configuration\nmodule.exports = config;\nmodule.exports = Encore.getWebpackConfig();\n" } ]
PHP
MIT License
bolt/core
removed tinymce from webpack
95,144
22.10.2018 13:30:25
-7,200
3550237d73b0e3299e4c40a8dacdc755cec66ca3
Adding placeholders for more fields
[ { "change_type": "MODIFY", "old_path": "assets/js/Views/editor.js", "new_path": "assets/js/Views/editor.js", "diff": "@@ -3,7 +3,7 @@ import Vue from \"vue\";\n* Editor Components\n*/\nimport Slug from \"../Components/Editor/Slug.vue\";\n-import TextArea from \"../Components/Editor/Slug.vue\";\n+import TextArea from \"../Components/Editor/TextArea.vue\";\nimport Markdown from \"../Components/Editor/Markdown.vue\";\nimport Html from \"../Components/Editor/Html.vue\";\nimport DateTime from \"../Components/Editor/DateTime.vue\";\n" }, { "change_type": "MODIFY", "old_path": "assets/js/bolt.js", "new_path": "assets/js/bolt.js", "diff": "\"use strict\";\n+\n/**\n* Vue Core | Config\n*/\nimport \"./helpers/filters\";\n// import './registerServiceWorker'\n+\n/**\n* Bootstrap Javascript\n*/\nimport \"bootstrap\";\n+\n/**\n* Styling\n*/\nimport \"../scss/bolt.scss\";\n+\n/**\n* Vue Components\n*/\nimport \"./Views/editor\";\nimport \"./Views/base\";\n+// This loads jquery, And sets a global $ and jQuery variable. We should keep it,\n+// for extensions / modules that require a global `$`.\n+const $ = require(\"jquery\");\n+global.$ = global.jQuery = $;\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/Runtime/ContentHelperRuntime.php", "new_path": "src/Twig/Runtime/ContentHelperRuntime.php", "diff": "@@ -28,6 +28,10 @@ class ContentHelperRuntime\n];\n}\n+ if (!is_iterable($values)) {\n+ return $options;\n+ }\n+\nforeach ($values as $key => $value) {\n$options[] = [\n'key' => $key,\n" }, { "change_type": "ADD", "old_path": null, "new_path": "templates/editcontent/fields/checkbox.twig", "diff": "+{% extends '@bolt/editcontent/fields/_base.twig' %}\n+\n+{% block field %}\n+ <label>{{ label }}</label>\n+ <input name=\"{{ name }}\" placeholder=\"First Name\" type=\"checkbox\" value=\"{{ value }}\">\n+{% endblock %}\n+\n" }, { "change_type": "ADD", "old_path": null, "new_path": "templates/editcontent/fields/date.twig", "diff": "+{% extends '@bolt/editcontent/fields/_base.twig' %}\n+\n+{% block field %}\n+ {# Check Attributes #}\n+ {% if readonly is not defined %}\n+ {% set readonly = false %}\n+ {% endif %}\n+ {% if form is not defined %}\n+ {% set form = '' %}\n+ {% endif %}\n+ {# for timestamps, make sure it's formatted correctly #}\n+ {% if value.timestamp is defined %}\n+ {% set value = value|date(format='c') %}\n+ {% endif %}\n+\n+ <editor-date\n+ :value=\"'{{ value }}'\"\n+ :label=\"'{{ label }}'\"\n+ :name=\"'{{ name }}'\"\n+ :readonly=\"'{{ readonly }}'\"\n+ :form=\"'{{ form }}'\"\n+ ></editor-date>\n+{% endblock %}\n+\n" }, { "change_type": "ADD", "old_path": null, "new_path": "templates/editcontent/fields/embed.twig", "diff": "+{% extends '@bolt/editcontent/fields/_base.twig' %}\n+\n+{% block field %}\n+ <label>{{ label }}</label>\n+ <input name=\"{{ name }}\" placeholder=\"First Name\" type=\"text\" value=\"{{ value }}\" class=\"{{ class }}\" {{ attributes|default()|raw }}>\n+\n+ (Embed preview, and some meta fields go here)\n+\n+{% endblock %}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "templates/editcontent/fields/file.twig", "diff": "+{% extends '@bolt/editcontent/fields/_base.twig' %}\n+\n+{% block field %}\n+ <label>{{ label }}</label>\n+\n+ <div class=\"row\" style=\"margin-right: 0;\">\n+ <div class=\"col-8\">\n+\n+ <div class=\"row mb-2\">\n+ <div class=\"col-3\">\n+ <label>Filename</label>\n+ </div>\n+ <div class=\"col-9\">\n+ <input name=\"{{ name }}[filename]\" id=\"{{ id }}-filename\" placeholder=\"filename.jpg\" type=\"text\" value=\"{{ field.get('filename') }}\" class=\"{{ class }}\" {{ attributes|default()|raw }}>\n+ </div>\n+\n+ </div>\n+\n+ <div class=\"row mb-2\">\n+ <div class=\"col-3\">\n+ <label>Alt</label>\n+ </div>\n+ <div class=\"col-9\">\n+ <input name=\"{{ name }}[alt]\" placeholder=\"An image depicting a kitten\" type=\"text\" value=\"{{ field.get('alt') }}\" class=\"{{ class }}\" {{ attributes|default()|raw }}>\n+ </div>\n+ </div>\n+\n+ <div class=\"row mb-2\">\n+ <div class=\"col-3\">\n+ <label>Title</label>\n+ </div>\n+ <div class=\"col-9\">\n+ <input name=\"{{ name }}[alt]\" placeholder=\"A description of this image\" type=\"text\" value=\"{{ field.get('title') }}\" class=\"{{ class }}\" {{ attributes|default()|raw }}>\n+ </div>\n+ </div>\n+\n+ <div class=\"row mb-2\">\n+ <div class=\"col-12\" style=\"text-align: right;\">\n+ {% if field.get('filename') %}\n+ <a href=\"{{ field.get('filename')|thumbnail(width=1000, height=1000, area='files') }}\" class=\"btn btn-secondary btn-small lightbox\" style=\"color: #FFF;\">\n+ view image\n+ </a>\n+ {% endif %}\n+ <a href=\"\" onclick=\"document.querySelector('.filepond--drop-label label').click(); return false;\" class=\"btn btn-secondary btn-small\" style=\"color: #FFF;\">Upload an image</a>\n+ </div>\n+ </div>\n+\n+ </div>\n+ <div class=\"col-4\" id=\"{{ id }}-uploader\" style=\"padding: 0; min-height: 180px;\">\n+ {# <file-pond name=\"filepond[]\" ref=\"pond\" accepted-file-types=\"image/jpeg, image/png\" server=\"/async/upload\"></file-pond> #}\n+ </div>\n+\n+ </div>\n+\n+ <mark>Note: This field is practically the same as the <code>image</code>-field.</mark>\n+\n+{% endblock %}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "templates/editcontent/fields/filelist.twig", "diff": "+{% extends '@bolt/editcontent/fields/_base.twig' %}\n+\n+{% block field %}\n+ <label>{{ label }}</label>\n+ <input name=\"{{ name }}\" placeholder=\"First Name\" type=\"text\" value=\"{{ value }}\" class=\"{{ class }}\" {{ attributes|default()|raw }}>\n+ <input name=\"{{ name }}\" placeholder=\"First Name\" type=\"text\" value=\"{{ value }}\" class=\"{{ class }}\" {{ attributes|default()|raw }}>\n+ <input name=\"{{ name }}\" placeholder=\"First Name\" type=\"text\" value=\"{{ value }}\" class=\"{{ class }}\" {{ attributes|default()|raw }}>\n+\n+ <mark>Note: This field is practically the same as the <code>imagelist</code>-field.</mark>\n+\n+{% endblock %}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "templates/editcontent/fields/float.twig", "diff": "+{% extends '@bolt/editcontent/fields/_base.twig' %}\n+\n+{% block field %}\n+ <label>{{ label }}</label>\n+ <input name=\"{{ name }}\" placeholder=\"First Name\" type=\"number\" step=\"1\" value=\"{{ value }}\" class=\"{{ class }}\" {{ attributes|default()|raw }}>\n+\n+ <mark>Note: This field is practically the same as the <code>integer</code>-field.</mark>\n+\n+{% endblock %}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "templates/editcontent/fields/geolocation.twig", "diff": "+{% extends '@bolt/editcontent/fields/_base.twig' %}\n+\n+{% block field %}\n+ <label>{{ label }}</label>\n+ <input name=\"{{ name }}\" placeholder=\"First Name\" type=\"text\" value=\"{{ value }}\" class=\"{{ class }}\" {{ attributes|default()|raw }}>\n+\n+ (Small map, lat and long go here, somewhere)\n+{% endblock %}\n" }, { "change_type": "MODIFY", "old_path": "templates/editcontent/fields/image.twig", "new_path": "templates/editcontent/fields/image.twig", "diff": "<div class=\"row mb-2\">\n<div class=\"col-12\" style=\"text-align: right;\">\n- <a href=\"{{ field.get('filename')|thumbnail(width=1000, height=1000, area='files') }}\" class=\"btn btn-secondary btn-small lightbox\" style=\"color: #FFF;\">view image</a>\n+ {% if field.get('filename') %}\n+ <a href=\"{{ field.get('filename')|thumbnail(width=1000, height=1000, area='files') }}\" class=\"btn btn-secondary btn-small lightbox\" style=\"color: #FFF;\">\n+ view image\n+ </a>\n+ {% endif %}\n<a href=\"\" onclick=\"document.querySelector('.filepond--drop-label label').click(); return false;\" class=\"btn btn-secondary btn-small\" style=\"color: #FFF;\">Upload an image</a>\n</div>\n</div>\n" }, { "change_type": "ADD", "old_path": null, "new_path": "templates/editcontent/fields/imagelist.twig", "diff": "+{% extends '@bolt/editcontent/fields/_base.twig' %}\n+\n+{% block field %}\n+ <label>{{ label }}</label>\n+ <input name=\"{{ name }}\" placeholder=\"First Name\" type=\"text\" value=\"{{ value }}\" class=\"{{ class }}\" {{ attributes|default()|raw }}>\n+ <input name=\"{{ name }}\" placeholder=\"First Name\" type=\"text\" value=\"{{ value }}\" class=\"{{ class }}\" {{ attributes|default()|raw }}>\n+ <input name=\"{{ name }}\" placeholder=\"First Name\" type=\"text\" value=\"{{ value }}\" class=\"{{ class }}\" {{ attributes|default()|raw }}>\n+\n+ <mark>Note: This field is practically the same as the <code>filelist</code>-field.</mark>\n+\n+{% endblock %}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "templates/editcontent/fields/integer.twig", "diff": "+{% extends '@bolt/editcontent/fields/_base.twig' %}\n+\n+{% block field %}\n+ <label>{{ label }}</label>\n+ <input name=\"{{ name }}\" placeholder=\"First Name\" type=\"number\" step=\"1\" value=\"{{ value }}\" class=\"{{ class }}\" {{ attributes|default()|raw }}>\n+{% endblock %}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "templates/editcontent/fields/repeater.twig", "diff": "+{% extends '@bolt/editcontent/fields/_base.twig' %}\n+\n+{% block field %}\n+ <label>{{ label }}</label>\n+\n+ <mark>Note: The Repeater / Block field is basically a wrapper for other fields.</mark>\n+\n+{% endblock %}\n" }, { "change_type": "MODIFY", "old_path": "templates/editcontent/fields/textarea.twig", "new_path": "templates/editcontent/fields/textarea.twig", "diff": "{% block field %}\n<editor-textarea\n- :value=\"'{{ value }}'\"\n+ :value=\"'{{ value|json_encode() }}'\"\n:label=\"'{{ label }}'\"\n:name=\"'{{ name }}'\"\n></editor-textarea>\n" }, { "change_type": "ADD", "old_path": null, "new_path": "templates/editcontent/fields/video.twig", "diff": "+{% extends '@bolt/editcontent/fields/_base.twig' %}\n+\n+{% block field %}\n+ <label>{{ label }}</label>\n+ <input name=\"{{ name }}\" placeholder=\"First Name\" type=\"text\" value=\"{{ value }}\" class=\"{{ class }}\" {{ attributes|default()|raw }}>\n+\n+ <p>(Video preview, and some meta fields go here)</p>\n+\n+ <mark>Note: This field is _practically_ the same as the <code>video</code>-field, only a bit more specific. Do we even need this one?</mark>\n+\n+{% endblock %}\n+\n" } ]
PHP
MIT License
bolt/core
Adding placeholders for more fields
95,144
22.10.2018 21:46:02
-7,200
d4ebcc60373d1d029075127e9a66cbda3bfb2e30
Handling Fileuploads with Sirius/Upload
[ { "change_type": "MODIFY", "old_path": "composer.json", "new_path": "composer.json", "diff": "\"nesbot/carbon\": \"^1.34\",\n\"sensio/framework-extra-bundle\": \"^5.1\",\n\"sensiolabs/security-checker\": \"^4.1\",\n+ \"siriusphp/upload\": \"^2.1\",\n\"stof/doctrine-extensions-bundle\": \"^1.3\",\n\"symfony/asset\": \"^4.1\",\n\"symfony/console\": \"^4.1\",\n" }, { "change_type": "MODIFY", "old_path": "composer.lock", "new_path": "composer.lock", "diff": "\"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies\",\n\"This file is @generated automatically\"\n],\n- \"content-hash\": \"7dddc0ca15241d0fd198ce1d563aa2c5\",\n+ \"content-hash\": \"0304e9ca1d26ae01e3e1b529c08840aa\",\n\"packages\": [\n{\n\"name\": \"api-platform/api-pack\",\n\"description\": \"A security checker for your composer.lock\",\n\"time\": \"2018-02-28T22:10:01+00:00\"\n},\n+ {\n+ \"name\": \"siriusphp/upload\",\n+ \"version\": \"2.1.1\",\n+ \"source\": {\n+ \"type\": \"git\",\n+ \"url\": \"https://github.com/siriusphp/upload.git\",\n+ \"reference\": \"1bfd8b1f228ec419424c8acd1ccd86d53541ad94\"\n+ },\n+ \"dist\": {\n+ \"type\": \"zip\",\n+ \"url\": \"https://api.github.com/repos/siriusphp/upload/zipball/1bfd8b1f228ec419424c8acd1ccd86d53541ad94\",\n+ \"reference\": \"1bfd8b1f228ec419424c8acd1ccd86d53541ad94\",\n+ \"shasum\": \"\"\n+ },\n+ \"require\": {\n+ \"php\": \">=5.3\",\n+ \"siriusphp/validation\": \"~2.1\"\n+ },\n+ \"require-dev\": {\n+ \"phpunit/phpunit\": \"~4.8\"\n+ },\n+ \"suggest\": {\n+ \"knplabs/gaufrette\": \"Alternative filesystem abstraction library for upload destinations\",\n+ \"league/flysystem\": \"To upload to different destinations, not just to the local file system\"\n+ },\n+ \"type\": \"library\",\n+ \"autoload\": {\n+ \"psr-4\": {\n+ \"Sirius\\\\Upload\\\\\": \"src/\"\n+ }\n+ },\n+ \"notification-url\": \"https://packagist.org/downloads/\",\n+ \"license\": [\n+ \"MIT\"\n+ ],\n+ \"authors\": [\n+ {\n+ \"name\": \"Adrian Miu\",\n+ \"email\": \"adrian@adrianmiu.ro\"\n+ }\n+ ],\n+ \"description\": \"Framework agnostic upload library\",\n+ \"keywords\": [\n+ \"file\",\n+ \"form\",\n+ \"upload\",\n+ \"validation\"\n+ ],\n+ \"time\": \"2017-07-31T08:18:59+00:00\"\n+ },\n+ {\n+ \"name\": \"siriusphp/validation\",\n+ \"version\": \"2.2.2\",\n+ \"source\": {\n+ \"type\": \"git\",\n+ \"url\": \"https://github.com/siriusphp/validation.git\",\n+ \"reference\": \"f8d5fd657dfd5f9e33bfafab2439ea6e19f3240c\"\n+ },\n+ \"dist\": {\n+ \"type\": \"zip\",\n+ \"url\": \"https://api.github.com/repos/siriusphp/validation/zipball/f8d5fd657dfd5f9e33bfafab2439ea6e19f3240c\",\n+ \"reference\": \"f8d5fd657dfd5f9e33bfafab2439ea6e19f3240c\",\n+ \"shasum\": \"\"\n+ },\n+ \"require\": {\n+ \"php\": \">=5.3\"\n+ },\n+ \"require-dev\": {\n+ \"phpunit/phpunit\": \"^3.7\"\n+ },\n+ \"type\": \"library\",\n+ \"autoload\": {\n+ \"psr-4\": {\n+ \"Sirius\\\\Validation\\\\\": \"src/\"\n+ }\n+ },\n+ \"notification-url\": \"https://packagist.org/downloads/\",\n+ \"license\": [\n+ \"MIT\"\n+ ],\n+ \"authors\": [\n+ {\n+ \"name\": \"Adrian Miu\",\n+ \"email\": \"adrian@adrianmiu.ro\"\n+ }\n+ ],\n+ \"description\": \"Data validation library. Validate arrays, array objects, domain models etc using a simple API. Easily add your own validators on top of the already dozens built-in validation rules\",\n+ \"keywords\": [\n+ \"form\",\n+ \"modeling\",\n+ \"sanitization\",\n+ \"security\",\n+ \"validation\"\n+ ],\n+ \"time\": \"2018-06-01T11:55:44+00:00\"\n+ },\n{\n\"name\": \"stof/doctrine-extensions-bundle\",\n\"version\": \"v1.3.0\",\n},\n{\n\"name\": \"friendsofphp/php-cs-fixer\",\n- \"version\": \"v2.13.0\",\n+ \"version\": \"v2.13.1\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/FriendsOfPHP/PHP-CS-Fixer.git\",\n- \"reference\": \"7136aa4e0c5f912e8af82383775460d906168a10\"\n+ \"reference\": \"54814c62d5beef3ba55297b9b3186ed8b8a1b161\"\n},\n\"dist\": {\n\"type\": \"zip\",\n- \"url\": \"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/7136aa4e0c5f912e8af82383775460d906168a10\",\n- \"reference\": \"7136aa4e0c5f912e8af82383775460d906168a10\",\n+ \"url\": \"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/54814c62d5beef3ba55297b9b3186ed8b8a1b161\",\n+ \"reference\": \"54814c62d5beef3ba55297b9b3186ed8b8a1b161\",\n\"shasum\": \"\"\n},\n\"require\": {\n\"ext-tokenizer\": \"*\",\n\"php\": \"^5.6 || >=7.0 <7.3\",\n\"php-cs-fixer/diff\": \"^1.3\",\n- \"symfony/console\": \"^3.2 || ^4.0\",\n+ \"symfony/console\": \"^3.4.17 || ^4.1.6\",\n\"symfony/event-dispatcher\": \"^3.0 || ^4.0\",\n\"symfony/filesystem\": \"^3.0 || ^4.0\",\n\"symfony/finder\": \"^3.0 || ^4.0\",\n\"php-cs-fixer\"\n],\n\"type\": \"application\",\n- \"extra\": {\n- \"branch-alias\": {\n- \"dev-master\": \"2.13-dev\"\n- }\n- },\n\"autoload\": {\n\"psr-4\": {\n\"PhpCsFixer\\\\\": \"src/\"\n}\n],\n\"description\": \"A tool to automatically fix PHP code style\",\n- \"time\": \"2018-08-23T13:15:44+00:00\"\n+ \"time\": \"2018-10-21T00:32:10+00:00\"\n},\n{\n\"name\": \"jean85/pretty-package-versions\",\n},\n{\n\"name\": \"phpstan/phpstan\",\n- \"version\": \"0.10.3\",\n+ \"version\": \"0.10.5\",\n\"source\": {\n\"type\": \"git\",\n\"url\": \"https://github.com/phpstan/phpstan.git\",\n- \"reference\": \"dc62f78c9aa6e9f7c44e8d6518f1123cd1e1b1c0\"\n+ \"reference\": \"c6a8cd1fe08a23b9d101a55ffa9ff6b91d71ef5d\"\n},\n\"dist\": {\n\"type\": \"zip\",\n- \"url\": \"https://api.github.com/repos/phpstan/phpstan/zipball/dc62f78c9aa6e9f7c44e8d6518f1123cd1e1b1c0\",\n- \"reference\": \"dc62f78c9aa6e9f7c44e8d6518f1123cd1e1b1c0\",\n+ \"url\": \"https://api.github.com/repos/phpstan/phpstan/zipball/c6a8cd1fe08a23b9d101a55ffa9ff6b91d71ef5d\",\n+ \"reference\": \"c6a8cd1fe08a23b9d101a55ffa9ff6b91d71ef5d\",\n\"shasum\": \"\"\n},\n\"require\": {\n- \"composer/xdebug-handler\": \"^1.0\",\n+ \"composer/xdebug-handler\": \"^1.3.0\",\n\"jean85/pretty-package-versions\": \"^1.0.3\",\n\"nette/bootstrap\": \"^2.4 || ^3.0\",\n\"nette/di\": \"^2.4.7 || ^3.0\",\n},\n\"require-dev\": {\n\"brianium/paratest\": \"^2.0\",\n- \"consistence/coding-standard\": \"^3.3\",\n+ \"consistence/coding-standard\": \"^3.5\",\n\"dealerdirect/phpcodesniffer-composer-installer\": \"^0.4.4\",\n\"ext-gd\": \"*\",\n\"ext-intl\": \"*\",\n\"ext-mysqli\": \"*\",\n\"ext-zip\": \"*\",\n\"jakub-onderka/php-parallel-lint\": \"^1.0\",\n- \"localheinz/composer-normalize\": \"~0.8.0\",\n+ \"localheinz/composer-normalize\": \"~0.9.0\",\n\"phing/phing\": \"^2.16.0\",\n\"phpstan/phpstan-deprecation-rules\": \"^0.10.2\",\n\"phpstan/phpstan-php-parser\": \"^0.10\",\n\"phpstan/phpstan-phpunit\": \"^0.10\",\n\"phpstan/phpstan-strict-rules\": \"^0.10\",\n\"phpunit/phpunit\": \"^7.0\",\n- \"slevomat/coding-standard\": \"^4.6.2\"\n+ \"slevomat/coding-standard\": \"^4.7.2\"\n},\n\"bin\": [\n\"bin/phpstan\"\n\"MIT\"\n],\n\"description\": \"PHPStan - PHP Static Analysis Tool\",\n- \"time\": \"2018-08-12T15:14:21+00:00\"\n+ \"time\": \"2018-10-20T17:24:55+00:00\"\n},\n{\n\"name\": \"symfony/browser-kit\",\n" }, { "change_type": "MODIFY", "old_path": "src/Content/MediaFactory.php", "new_path": "src/Content/MediaFactory.php", "diff": "@@ -7,17 +7,13 @@ declare(strict_types=1);\nnamespace Bolt\\Content;\n-use Bolt\\Common\\Json;\nuse Bolt\\Configuration\\Config;\nuse Bolt\\Entity\\Media;\n-use Bolt\\Media\\Item;\nuse Bolt\\Repository\\MediaRepository;\nuse Carbon\\Carbon;\n-use Cocur\\Slugify\\Slugify;\nuse Faker\\Factory;\nuse PHPExif\\Reader\\Reader;\nuse Symfony\\Component\\DependencyInjection\\ContainerInterface;\n-use Symfony\\Component\\Filesystem\\Filesystem;\nuse Symfony\\Component\\Finder\\SplFileInfo;\nuse Webmozart\\PathUtil\\Path;\n@@ -32,6 +28,13 @@ class MediaFactory\n/** @var ContainerInterface */\nprivate $container;\n+ /**\n+ * MediaFactory constructor.\n+ *\n+ * @param Config $config\n+ * @param MediaRepository $mediaRepository\n+ * @param ContainerInterface $container\n+ */\npublic function __construct(Config $config, MediaRepository $mediaRepository, ContainerInterface $container)\n{\n$this->config = $config;\n@@ -77,6 +80,10 @@ class MediaFactory\nreturn $media;\n}\n+ /**\n+ * @param Media $media\n+ * @param $file\n+ */\nprivate function updateImageData(Media $media, $file)\n{\n/** @var Exif $exif */\n@@ -99,11 +106,19 @@ class MediaFactory\n}\n}\n+ /**\n+ * @param $media\n+ *\n+ * @return bool\n+ */\nprivate function isImage($media)\n{\nreturn in_array($media->getType(), ['gif', 'png', 'jpg', 'svg'], true);\n}\n+ /**\n+ * @return object|string|void\n+ */\nprotected function getUser()\n{\nif (!$this->container->has('security.token_storage')) {\n@@ -123,54 +138,19 @@ class MediaFactory\n}\n/**\n- * @param Item $item\n- * @param $params\n+ * @param $area\n+ * @param $path\n+ * @param $filename\n*\n* @return Media\n*/\n- public function createFromUpload(Item $item, $params): Media\n+ public function createFromFilename($area, $path, $filename): Media\n{\n- if (Json::test($params)) {\n- $params = Json::parse($params);\n- $addedPath = $params['path'];\n- $area = $params['area'];\n- } else {\n- $addedPath = '';\n- $area = 'files';\n- }\n-\n- $targetFilename = $addedPath . \\DIRECTORY_SEPARATOR . $this->sanitiseFilename($item->getName());\n-\n- $source = $this->config->getPath('cache', true, ['uploads', $item->getId(), $item->getName()]);\n- $target = $this->config->getPath($area, true, $targetFilename);\n-\n- $relPath = Path::getDirectory($targetFilename);\n- $relName = Path::getFilename($targetFilename);\n-\n- // Move the file over\n- $fileSystem = new Filesystem();\n- $fileSystem->rename($source, $target, true);\n-\n- $file = new SplFileInfo($target, $relPath, $relName);\n+ $target = $this->config->getPath($area, true, [$path, $filename]);\n+ $file = new SplFileInfo($target, $path, $filename);\n$media = $this->createOrUpdateMedia($file, $area);\nreturn $media;\n}\n-\n- /**\n- * @param string $filename\n- *\n- * @return string\n- */\n- private function sanitiseFilename(string $filename): string\n- {\n- $extensionSlug = new Slugify(['regexp' => '/([^a-z0-9]|-)+/']);\n- $filenameSlug = new Slugify(['lowercase' => false]);\n-\n- $extension = $extensionSlug->slugify(Path::getExtension($filename));\n- $filename = $filenameSlug->slugify(Path::getFilenameWithoutExtension($filename));\n-\n- return $filename . '.' . $extension;\n- }\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Controller/Async/Uploader.php", "new_path": "src/Controller/Async/Uploader.php", "diff": "@@ -4,12 +4,17 @@ declare(strict_types=1);\nnamespace Bolt\\Controller\\Async;\n+use Bolt\\Configuration\\Config;\nuse Bolt\\Content\\MediaFactory;\nuse Bolt\\Media\\RequestHandler;\n+use Cocur\\Slugify\\Slugify;\nuse Doctrine\\Common\\Persistence\\ObjectManager;\n+use Sirius\\Upload\\Handler;\n+use Sirius\\Upload\\Result\\File;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\Routing\\Annotation\\Route;\n+use Webmozart\\PathUtil\\Path;\nclass Uploader\n{\n@@ -22,11 +27,15 @@ class Uploader\n/** @var ObjectManager */\nprivate $manager;\n- public function __construct(MediaFactory $mediaFactory, RequestHandler $requestHandler, ObjectManager $manager)\n+ /** @var Config */\n+ private $config;\n+\n+ public function __construct(MediaFactory $mediaFactory, RequestHandler $requestHandler, ObjectManager $manager, Config $config)\n{\n$this->mediaFactory = $mediaFactory;\n$this->requestHandler = $requestHandler;\n$this->manager = $manager;\n+ $this->config = $config;\n}\n/**\n@@ -34,25 +43,60 @@ class Uploader\n*/\npublic function upload(Request $request)\n{\n- // Get submitted field data item, will always be one item in case of async upload\n- $items = $this->requestHandler->loadFilesByField('filepond');\n+// $uploadHandler = new Handler('/path/to/local_folder');\n- // If no items, exit\n- if (count($items) === 0) {\n- // Something went wrong, most likely a field name mismatch\n- http_response_code(400);\n+ $area = $request->query->get('area', '');\n+ $path = $request->query->get('path', '');\n- return;\n- }\n+ $target = $this->config->getPath($area, true, $path);\n+\n+ $uploadHandler = new Handler($target, [\n+ Handler::OPTION_AUTOCONFIRM => true,\n+ Handler::OPTION_OVERWRITE => true,\n+ ]);\n+\n+ $uploadHandler->addRule('extension', ['allowed' => 'jpg', 'jpeg', 'png'], '{label} should be a valid image (jpg, jpeg, png)', 'Profile picture');\n+ $uploadHandler->addRule('size', ['max' => '20M'], '{label} should have less than {max}', 'Profile picture');\n+ $uploadHandler->setSanitizerCallback(function ($name) {\n+ return $this->sanitiseFilename($name);\n+ });\n- $params = $request->request->get('filepond', []);\n+ /** @var File $result */\n+ $result = $uploadHandler->process($_FILES);\n- foreach ($items as $item) {\n- $media = $this->mediaFactory->createFromUpload($item, current($params));\n+ if ($result->isValid()) {\n+ try {\n+ $media = $this->mediaFactory->createFromFilename($area, $path, $result->name);\n$this->manager->persist($media);\n$this->manager->flush();\n+\n+ return new Response($result->name);\n+ } catch (\\Exception $e) {\n+ // something wrong happened, we don't need the uploaded files anymore\n+ $result->clear();\n+ throw $e;\n+ }\n+ } else {\n+ // image was not moved to the container, where are error messages\n+ $messages = $result->getMessages();\n}\n- return new Response($media->getPath() . $media->getFilename());\n+ return new Response('Not OK');\n+ }\n+\n+ /**\n+ * @param string $filename\n+ *\n+ * @return string\n+ */\n+ private function sanitiseFilename(string $filename): string\n+ {\n+ $extensionSlug = new Slugify(['regexp' => '/([^a-z0-9]|-)+/']);\n+ $filenameSlug = new Slugify(['lowercase' => false]);\n+\n+ $extension = $extensionSlug->slugify(Path::getExtension($filename));\n+ $filename = $filenameSlug->slugify(Path::getFilenameWithoutExtension($filename));\n+\n+ return $filename . '.' . $extension;\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "symfony.lock", "new_path": "symfony.lock", "diff": "\"ref\": \"576d653444dade07f272c889d52fe4594caa4fc3\"\n}\n},\n+ \"siriusphp/upload\": {\n+ \"version\": \"2.1.1\"\n+ },\n+ \"siriusphp/validation\": {\n+ \"version\": \"2.2.2\"\n+ },\n\"stof/doctrine-extensions-bundle\": {\n\"version\": \"1.2\",\n\"recipe\": {\n" }, { "change_type": "MODIFY", "old_path": "templates/finder/_uploader.twig", "new_path": "templates/finder/_uploader.twig", "diff": "-<link rel=\"stylesheet\" href=\"https://unpkg.com/filepond/dist/filepond.min.css\">\n-<link rel=\"stylesheet\" href=\"https://unpkg.com/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.min.css\">\n-\n-<script src=\"https://unpkg.com/filepond-plugin-image-preview\"></script>\n-<script src=\"https://unpkg.com/filepond-plugin-file-metadata/dist/filepond-plugin-file-metadata.js\"></script>\n-<script src=\"https://unpkg.com/filepond\"></script>\n-<script src=\"https://unpkg.com/vue\"></script>\n-<script src=\"https://unpkg.com/vue-filepond\"></script>\n+<script src=\"https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.5.1/dropzone.js\" integrity=\"sha256-awEOL+kdrMJU/HUksRrTVHc6GA25FvDEIJ4KaEsFfG4=\" crossorigin=\"anonymous\"></script>\n+<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.5.1/basic.css\" integrity=\"sha256-NI6EfwSJhhs7gXBPbwLXD00msI29Bku3GDJT8gYW+gc=\" crossorigin=\"anonymous\" />\n<div class=\"card mb-4\">\n<div class=\"card-header\">File uploader</div>\n- <div id=\"uploader\">\n- <file-pond name=\"filepond[]\"\n- ref=\"pond\"\n- allow-multiple=\"true\"\n- accepted-file-types=\"image/jpeg, image/png\"\n- server=\"/async/upload\"></file-pond>\n- </div>\n+\n+ <script type=\"text/javascript\" src=\"https://rawgit.com/enyo/dropzone/master/dist/dropzone.js\"></script>\n+\n+ <form action=\"{{ path('bolt_upload_post', {'area': area, 'path': path}) }}\" method=\"POST\" class=\"dropzone\" style=\"width:200px; height:200px; border:1px dashed crimson\">\n+ <div class=\"fallback\">\n+ <input name=\"file\" type=\"file\" multiple />\n</div>\n+ </form>\n+</div>\n-<script>\n- FilePond.registerPlugin(\n- FilePondPluginFileMetadata,\n- FilePondPluginImagePreview\n- );\n- FilePond.setOptions({\n- fileMetadataObject: {\n- 'area': '{{ area }}',\n- 'path': '{{ path }}'\n- }\n- });\n- new Vue({\n- el: '#uploader',\n- components: {\n- FilePond: vueFilePond.default()\n- }\n- });\n-</script>\n" } ]
PHP
MIT License
bolt/core
Handling Fileuploads with Sirius/Upload
95,144
23.10.2018 21:30:21
-7,200
fd948a1a90901c480d32d3127404f40d57211cd6
Update .github/github_labels.json
[ { "change_type": "ADD", "old_path": null, "new_path": ".github/github_labels.json", "diff": "+[\n+ {\n+ \"name\": \"priority: critical\",\n+ \"color\": \"#e11d21\"\n+ },\n+ {\n+ \"name\": \"priority: high\",\n+ \"color\": \"#eb6420\"\n+ },\n+ {\n+ \"name\": \"priority: low\",\n+ \"color\": \"#68cbf2\"\n+ },\n+ {\n+ \"name\": \"priority: medium\",\n+ \"color\": \"#fbca04\"\n+ },\n+ {\n+ \"name\": \"status: accepted\",\n+ \"color\": \"#4eb8c4\"\n+ },\n+ {\n+ \"name\": \"status: blocked\",\n+ \"color\": \"#ebff54\"\n+ },\n+ {\n+ \"name\": \"status: completed\",\n+ \"color\": \"#006b75\"\n+ },\n+ {\n+ \"name\": \"status: in progress\",\n+ \"color\": \"#cccccc\"\n+ },\n+ {\n+ \"name\": \"status: pending\",\n+ \"color\": \"#fef2c0\"\n+ },\n+ {\n+ \"name\": \"status: review needed\",\n+ \"color\": \"#fbca04\"\n+ },\n+ {\n+ \"name\": \"status: wontfix\",\n+ \"color\": \"#d5f26d\"\n+ },\n+ {\n+ \"name\": \"tag: breaking change\",\n+ \"color\": \"#a838d1\"\n+ },\n+ {\n+ \"name\": \"tag: bug fix\",\n+ \"color\": \"#fbca04\"\n+ },\n+ {\n+ \"name\": \"tag: documentation\",\n+ \"color\": \"#cc317c\"\n+ },\n+ {\n+ \"name\": \"tag: duplicate\",\n+ \"color\": \"#bfe5bf\"\n+ },\n+ {\n+ \"name\": \"tag: enhancement\",\n+ \"color\": \"#84b6eb\"\n+ },\n+ {\n+ \"name\": \"tag: feature request\",\n+ \"color\": \"#cccccc\"\n+ },\n+ {\n+ \"name\": \"tag: internal\",\n+ \"color\": \"#cccccc\"\n+ },\n+ {\n+ \"name\": \"tag: needs splitting\",\n+ \"color\": \"#b88eed\"\n+ },\n+ {\n+ \"name\": \"tag: new feature\",\n+ \"color\": \"#35b848\"\n+ },\n+ {\n+ \"name\": \"tag: question\",\n+ \"color\": \"#cccccc\"\n+ },\n+ {\n+ \"name\": \"tag: refactor\",\n+ \"color\": \"#5890d8\"\n+ },\n+ {\n+ \"name\": \"topic: API\",\n+ \"color\": \"#b28133\"\n+ },\n+ {\n+ \"name\": \"topic: Base-2019 headless\",\n+ \"color\": \"#fca1b2\"\n+ },\n+ {\n+ \"name\": \"topic: Base-2019 traditional\",\n+ \"color\": \"#37d37d\"\n+ },\n+ {\n+ \"name\": \"topic: Blocks/Repeaters\",\n+ \"color\": \"#ffdcc4\"\n+ },\n+ {\n+ \"name\": \"topic: Content\",\n+ \"color\": \"#f99e43\"\n+ },\n+ {\n+ \"name\": \"topic: Controllers\",\n+ \"color\": \"#e99695\"\n+ },\n+ {\n+ \"name\": \"topic: Extensions\",\n+ \"color\": \"#fbca04\"\n+ },\n+ {\n+ \"name\": \"topic: Frontend\",\n+ \"color\": \"#eb6420\"\n+ },\n+ {\n+ \"name\": \"topic: Javascript\",\n+ \"color\": \"#e5c870\"\n+ },\n+ {\n+ \"name\": \"topic: Media\",\n+ \"color\": \"#84b6eb\"\n+ },\n+ {\n+ \"name\": \"topic: Multilingual\",\n+ \"color\": \"#cdfc23\"\n+ },\n+ {\n+ \"name\": \"topic: Twig\",\n+ \"color\": \"#BBCD3B\"\n+ },\n+ {\n+ \"name\": \"topic: Vue\",\n+ \"color\": \"#52B988\"\n+ },\n+ {\n+ \"name\": \"topic: Widgets\",\n+ \"color\": \"#1d88c6\"\n+ },\n+ {\n+ \"name\": \"topic: i18n\",\n+ \"color\": \"#fbca04\"\n+ },\n+ {\n+ \"name\": \"topic: search\",\n+ \"color\": \"#74e0c3\"\n+ }\n+]\n\\ No newline at end of file\n" } ]
PHP
MIT License
bolt/core
Update .github/github_labels.json
95,144
24.10.2018 18:52:18
-7,200
47eec649674eba34b65eb570b23a18581eb00601
updating PHP-CS config
[ { "change_type": "RENAME", "old_path": ".php_cs.dist", "new_path": ".php_cs", "diff": "<?php\n-$fileHeaderComment = <<<COMMENT\n-This file is part of the Symfony package.\n-\n-(c) Fabien Potencier <fabien@symfony.com>\n-\n-For the full copyright and license information, please view the LICENSE\n-file that was distributed with this source code.\n-COMMENT;\n-\n$finder = PhpCsFixer\\Finder::create()\n->in(__DIR__)\n->exclude('config')\n@@ -27,7 +18,6 @@ return PhpCsFixer\\Config::create()\n'@PSR2' => true,\n'@Symfony:risky' => true,\n'array_syntax' => ['syntax' => 'short'],\n-// 'header_comment' => ['header' => $fileHeaderComment, 'separate' => 'both'],\n'linebreak_after_opening_tag' => true,\n'mb_str_functions' => true,\n'no_php4_constructor' => true,\n" } ]
PHP
MIT License
bolt/core
updating PHP-CS config
95,144
25.10.2018 07:20:53
-7,200
e6a1d24f6e89f754194f2dd117f126f8a8ccc1f4
Adding more data to the sidebar JSON output
[ { "change_type": "MODIFY", "old_path": "src/Content/MenuBuilder.php", "new_path": "src/Content/MenuBuilder.php", "diff": "@@ -5,27 +5,51 @@ declare(strict_types=1);\nnamespace Bolt\\Content;\nuse Bolt\\Configuration\\Config;\n+use Bolt\\Entity\\Content;\n+use Bolt\\Repository\\ContentRepository;\nuse Knp\\Menu\\FactoryInterface;\n+use Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface;\n+use Symfony\\Component\\Stopwatch\\Stopwatch;\nclass MenuBuilder\n{\n+ /** @var FactoryInterface */\nprivate $factory;\n+ /** @var Config */\nprivate $config;\n+ /** @var Stopwatch */\n+ private $stopwatch;\n+\n+ /** @var ContentRepository */\n+ private $content;\n+\n+ /** @var UrlGeneratorInterface */\n+ private $urlGenerator;\n+\n/**\n* MenuBuilder constructor.\n*\n+ * @param FactoryInterface $factory\n* @param Config $config\n+ * @param Stopwatch $stopwatch\n+ * @param ContentRepository $content\n+ * @param UrlGeneratorInterface $urlGenerator\n*/\n- public function __construct(FactoryInterface $factory, Config $config)\n+ public function __construct(FactoryInterface $factory, Config $config, Stopwatch $stopwatch, ContentRepository $content, UrlGeneratorInterface $urlGenerator)\n{\n$this->config = $config;\n$this->factory = $factory;\n+ $this->stopwatch = $stopwatch;\n+ $this->content = $content;\n+ $this->urlGenerator = $urlGenerator;\n}\npublic function createSidebarMenu()\n{\n+ $this->stopwatch->start('bolt.sidebar');\n+\n$menu = $this->factory->createItem('root');\n$menu->addChild('Dashboard', ['uri' => 'homepage', 'extras' => [\n@@ -40,15 +64,22 @@ class MenuBuilder\n'icon_one' => 'fa-file',\n]]);\n- foreach ($this->config->get('contenttypes') as $contenttype) {\n- $menu->addChild($contenttype['name'], ['uri' => 'homepage', 'extras' => [\n+ $contenttypes = $this->config->get('contenttypes');\n+\n+ foreach ($contenttypes as $contenttype) {\n+ $menu->addChild($contenttype['slug'], ['uri' => 'homepage', 'extras' => [\n'name' => $contenttype['name'],\n+ 'singular_name' => $contenttype['singular_name'],\n+ 'slug' => $contenttype['slug'],\n+ 'singular_slug' => $contenttype['singular_slug'],\n'icon_one' => $contenttype['icon_one'],\n'icon_many' => $contenttype['icon_many'],\n- 'link' => '/bolt/content/' . $contenttype['slug'],\n+ 'link' => $this->urlGenerator->generate('bolt_contentlisting', ['contenttype' => $contenttype['slug']]),\n+ 'link_new' => $this->urlGenerator->generate('bolt_edit_record', ['id' => $contenttype['slug']]),\n'contenttype' => $contenttype['slug'],\n'singleton' => $contenttype['singleton'],\n'active' => $contenttype['slug'] === 'pages' ? true : false,\n+ 'records' => $this->getLatestRecords($contenttype['slug']),\n]]);\n}\n@@ -82,9 +113,34 @@ class MenuBuilder\n'link' => '/bolt/users',\n]]);\n+ $this->stopwatch->stop('bolt.sidebar');\n+\nreturn $menu;\n}\n+ private function getLatestRecords($slug)\n+ {\n+ /** @var ContentType $ct */\n+ $contenttype = ContentTypeFactory::get($slug, $this->config->get('contenttypes'));\n+\n+ /** @var Content $records */\n+ $records = $this->content->findAll(1, $contenttype);\n+\n+ $result = [];\n+\n+ /** @var Content $record */\n+ foreach ($records as $record) {\n+ $result[] = [\n+ 'id' => $record->getId(),\n+ 'title' => $record->magicTitle(),\n+ 'link' => $record->magicLink(),\n+ 'editlink' => $record->magicEditLink(),\n+ ];\n+ }\n+\n+ return $result;\n+ }\n+\npublic function getMenu()\n{\n$menu = $this->createSidebarMenu()->getChildren();\n@@ -93,14 +149,19 @@ class MenuBuilder\nforeach ($menu as $child) {\n$menuData[] = [\n- 'name' => $child->getLabel(),\n- 'icon_one' => $child->getExtra('icon_one') ? $child->getExtra('icon_one') : null,\n- 'icon_many' => $child->getExtra('icon_many') ? $child->getExtra('icon_many') : null,\n- 'link' => $child->getExtra('link') ? $child->getExtra('link') : null,\n- 'contenttype' => $child->getExtra('contenttype') ? $child->getExtra('contenttype') : null,\n- 'singleton' => $child->getExtra('singleton') ? $child->getExtra('singleton') : null,\n- 'type' => $child->getExtra('type') ? $child->getExtra('type') : null,\n- 'active' => $child->getExtra('active') ? $child->getExtra('active') : null,\n+ 'name' => $child->getExtra('name') ?: $child->getLabel(),\n+ 'singular_name' => $child->getExtra('singular_name'),\n+ 'slug' => $child->getExtra('slug'),\n+ 'singular_slug' => $child->getExtra('singular_slug'),\n+ 'icon_one' => $child->getExtra('icon_one'),\n+ 'icon_many' => $child->getExtra('icon_many'),\n+ 'link' => $child->getExtra('link'),\n+ 'link_new' => $child->getExtra('link_new'),\n+ 'contenttype' => $child->getExtra('contenttype'),\n+ 'singleton' => $child->getExtra('singleton'),\n+ 'type' => $child->getExtra('type'),\n+ 'active' => $child->getExtra('active'),\n+ 'records' => $child->getExtra('records'),\n];\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/ContentMagicTraits.php", "new_path": "src/Entity/ContentMagicTraits.php", "diff": "@@ -79,7 +79,7 @@ trait ContentMagicTraits\npublic function magicEditLink()\n{\n- $path = $this->urlGenerator->generate('record', ['slug' => $this->getSlug()]);\n+ $path = $this->urlGenerator->generate('bolt_edit_record', ['id' => $this->getId()]);\nreturn $path;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Twig/Extension/ContentHelperExtension.php", "new_path": "src/Twig/Extension/ContentHelperExtension.php", "diff": "@@ -41,11 +41,13 @@ class ContentHelperExtension extends AbstractExtension\n];\n}\n- public function sidebarmenu()\n+ public function sidebarmenu($pretty = false)\n{\n$menu = $this->menuBuilder->getMenu();\n- return json_encode($menu);\n+ $options = $pretty ? JSON_PRETTY_PRINT : 0;\n+\n+ return json_encode($menu, $options);\n}\npublic function fieldfactory($definition, $name = null)\n" } ]
PHP
MIT License
bolt/core
Adding more data to the sidebar JSON output
95,144
25.10.2018 20:28:13
-7,200
328760c906377185d1c6661a1d35273f1d880c35
Add icon and contenttype to Title {% block %}
[ { "change_type": "MODIFY", "old_path": "src/Twig/Extension/ContentHelperExtension.php", "new_path": "src/Twig/Extension/ContentHelperExtension.php", "diff": "@@ -6,6 +6,7 @@ namespace Bolt\\Twig\\Extension;\nuse Bolt\\Content\\FieldFactory;\nuse Bolt\\Content\\MenuBuilder;\n+use Bolt\\Entity\\Content;\nuse Bolt\\Twig\\Runtime;\nuse Twig\\Extension\\AbstractExtension;\nuse Twig\\TwigFunction;\n@@ -34,10 +35,13 @@ class ContentHelperExtension extends AbstractExtension\n*/\npublic function getFunctions(): array\n{\n+ $safe = ['is_safe' => ['html']];\n+\nreturn [\nnew TwigFunction('sidebarmenu', [$this, 'sidebarmenu']),\nnew TwigFunction('fieldfactory', [$this, 'fieldfactory']),\nnew TwigFunction('selectoptionsfromarray', [Runtime\\ContentHelperRuntime::class, 'selectoptionsfromarray']),\n+ new TwigFunction('icon', [$this, 'icon'], $safe),\n];\n}\n@@ -58,4 +62,15 @@ class ContentHelperExtension extends AbstractExtension\nreturn $field;\n}\n+\n+ public function icon($record, $icon = \"question-circle\")\n+ {\n+ if ($record instanceof Content) {\n+ $icon = $record->getDefinition()->get('icon_one') ?: $record->getDefinition()->get('icon_many');\n+ }\n+\n+ $icon = str_replace('fa-', '', $icon);\n+\n+ return \"<i class='fas fa-fw fa-$icon'></i>\";\n+ }\n}\n" } ]
PHP
MIT License
bolt/core
Add icon and contenttype to Title {% block %}
95,144
25.10.2018 20:38:04
-7,200
5159b4a7f8096b5ef9a8c38835f70abd253bda53
Tweak setPath :-)
[ { "change_type": "MODIFY", "old_path": "templates/editcontent/fields/image.twig", "new_path": "templates/editcontent/fields/image.twig", "diff": "{% extends '@bolt/editcontent/fields/_base.twig' %}\n{% block field %}\n- {% if field.definition['upload'] is defined %}\n- {% set setPath = field.definition.upload %}\n- {% else %}\n- {% set setPath = '' %}\n- {% endif %}\n-\n+ {% set setPath = field.definition.get('upload')|default('')) %}\n{% set directory = path('bolt_upload_post', {'area': area|default('files'), 'path': setPath}) %}\n<editor-image\n:label=\"'{{ label }}'\"\n" } ]
PHP
MIT License
bolt/core
Tweak setPath :-)
95,168
26.10.2018 13:29:21
-7,200
c41070f91d7aea2edc7de2a61a2e238810f5fe45
WIP to hide sensible and unwanted data in API
[ { "change_type": "MODIFY", "old_path": "src/Entity/Content.php", "new_path": "src/Entity/Content.php", "diff": "@@ -14,11 +14,14 @@ use Doctrine\\Common\\Collections\\ArrayCollection;\nuse Doctrine\\Common\\Collections\\Collection;\nuse Doctrine\\ORM\\Mapping as ORM;\nuse Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface;\n+use Symfony\\Component\\Serializer\\Annotation\\Groups;\n/**\n* @ApiResource(\n- * collectionOperations={\"get\"},\n- * itemOperations={\"get\"}\n+ * normalizationContext={\"groups\"={\"public\"}},\n+ * collectionOperations={\"get\"={\"access_control\"=\"is_granted('ROLE_ADMIN')\"}},\n+ * itemOperations={\"get\"={\"access_control\"=\"is_granted('ROLE_ADMIN')\"}}\n+ * )\n* )\n* @ApiFilter(SearchFilter::class)\n* @ORM\\Entity(repositoryClass=\"Bolt\\Repository\\ContentRepository\")\n@@ -37,11 +40,13 @@ class Content\n* @ORM\\Id()\n* @ORM\\GeneratedValue()\n* @ORM\\Column(type=\"integer\")\n+ * @Groups(\"public\")\n*/\nprivate $id;\n/**\n* @ORM\\Column(type=\"string\", length=191, name=\"contenttype\")\n+ * @Groups(\"public\")\n*/\nprivate $contentType;\n@@ -50,31 +55,37 @@ class Content\n*\n* @ORM\\ManyToOne(targetEntity=\"Bolt\\Entity\\User\")\n* @ORM\\JoinColumn(nullable=false)\n+ * @Groups(\"public\")\n*/\nprivate $author;\n/**\n* @ORM\\Column(type=\"string\", length=191)\n+ * @Groups(\"public\")\n*/\nprivate $status;\n/**\n* @ORM\\Column(type=\"datetime\")\n+ * @Groups(\"public\")\n*/\nprivate $createdAt;\n/**\n* @ORM\\Column(type=\"datetime\")\n+ * @Groups(\"public\")\n*/\nprivate $modifiedAt;\n/**\n* @ORM\\Column(type=\"datetime\", nullable=true)\n+ * @Groups(\"public\")\n*/\nprivate $publishedAt;\n/**\n* @ORM\\Column(type=\"datetime\")\n+ * @Groups(\"public\")\n*/\nprivate $depublishedAt;\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/Field.php", "new_path": "src/Entity/Field.php", "diff": "@@ -4,11 +4,13 @@ declare(strict_types=1);\nnamespace Bolt\\Entity;\n+use ApiPlatform\\Core\\Annotation\\ApiResource;\nuse Bolt\\Content\\FieldType;\nuse Bolt\\Content\\FieldTypeFactory;\nuse Doctrine\\ORM\\Mapping as ORM;\n/**\n+ * @ApiResource()\n* @ORM\\Entity(repositoryClass=\"Bolt\\Repository\\FieldRepository\")\n* @ORM\\Table(name=\"bolt_field\")\n* @ORM\\InheritanceType(\"SINGLE_TABLE\")\n" }, { "change_type": "MODIFY", "old_path": "src/Entity/User.php", "new_path": "src/Entity/User.php", "diff": "@@ -4,11 +4,18 @@ declare(strict_types=1);\nnamespace Bolt\\Entity;\n+use ApiPlatform\\Core\\Annotation\\ApiResource;\nuse Doctrine\\ORM\\Mapping as ORM;\nuse Symfony\\Component\\Security\\Core\\User\\UserInterface;\n+use Symfony\\Component\\Serializer\\Annotation\\Groups;\nuse Symfony\\Component\\Validator\\Constraints as Assert;\n/**\n+ * @ApiResource(\n+ * normalizationContext={\"groups\"={\"public\"}},\n+ * collectionOperations={\"get\"},\n+ * itemOperations={\"get\"}\n+ * )\n* @ORM\\Entity(repositoryClass=\"Bolt\\Repository\\UserRepository\")\n* @ORM\\Table(name=\"bolt_user\")\n*/\n@@ -20,6 +27,7 @@ class User implements UserInterface, \\Serializable\n* @ORM\\Id\n* @ORM\\GeneratedValue\n* @ORM\\Column(type=\"integer\")\n+ * @Groups(\"public\")\n*/\nprivate $id;\n@@ -28,6 +36,7 @@ class User implements UserInterface, \\Serializable\n*\n* @ORM\\Column(type=\"string\")\n* @Assert\\NotBlank()\n+ * @Groups(\"public\")\n*/\nprivate $fullName;\n@@ -37,6 +46,7 @@ class User implements UserInterface, \\Serializable\n* @ORM\\Column(type=\"string\", unique=true, length=190)\n* @Assert\\NotBlank()\n* @Assert\\Length(min=2, max=50)\n+ * @Groups(\"public\")\n*/\nprivate $username;\n@@ -59,16 +69,19 @@ class User implements UserInterface, \\Serializable\n* @var array\n*\n* @ORM\\Column(type=\"json\")\n+ * @Groups(\"public\")\n*/\nprivate $roles = [];\n/**\n* @ORM\\Column(type=\"datetime\", nullable=true)\n+ * @Groups(\"public\")\n*/\nprivate $lastseenAt;\n/**\n* @ORM\\Column(type=\"string\", length=100, nullable=true)\n+ * @Groups(\"public\")\n*/\nprivate $lastIp;\n" } ]
PHP
MIT License
bolt/core
WIP to hide sensible and unwanted data in API
95,144
26.10.2018 16:07:01
-7,200
a6dc0216494adf143c799f320fa5d63ce4cbf841
Herp derp derp
[ { "change_type": "MODIFY", "old_path": "templates/editcontent/fields/image.twig", "new_path": "templates/editcontent/fields/image.twig", "diff": "{% extends '@bolt/editcontent/fields/_base.twig' %}\n{% block field %}\n- {% set setPath = field.definition.get('upload')|default('')) %}\n+ {% set setPath = field.definition.get('upload')|default('') %}\n{% set directory = path('bolt_upload_post', {'area': area|default('files'), 'path': setPath}) %}\n<editor-image\n:label=\"'{{ label }}'\"\n" } ]
PHP
MIT License
bolt/core
Herp derp derp
95,168
26.10.2018 16:25:03
-7,200
8a1343b128fe0207866ac7268bfa97da8342e1ce
Add Configuration and File management submenus
[ { "change_type": "MODIFY", "old_path": "src/Content/MenuBuilder.php", "new_path": "src/Content/MenuBuilder.php", "diff": "@@ -79,7 +79,7 @@ class MenuBuilder\n'contenttype' => $contenttype['slug'],\n'singleton' => $contenttype['singleton'],\n'active' => $contenttype['slug'] === 'pages' ? true : false,\n- 'records' => $this->getLatestRecords($contenttype['slug']),\n+ 'submenu' => $this->getLatestRecords($contenttype['slug']),\n]]);\n}\n@@ -89,28 +89,112 @@ class MenuBuilder\n'icon_one' => 'fa-wrench',\n]]);\n+ // Configuration submenu\n+\n$menu->addChild('Configuration', ['uri' => 'configuration', 'extras' => [\n'name' => 'Configuration',\n'icon_one' => 'fa-flag',\n'link' => '/bolt/finder/config',\n]]);\n- $menu->addChild('Content Files', ['uri' => 'content-files', 'extras' => [\n- 'name' => 'Content Files',\n+ $menu['Configuration']->addChild('Users &amp; Permissions', ['uri' => 'users', 'extras' => [\n+ 'name' => 'Users &amp; Permissions',\n+ 'icon_one' => 'fa-group',\n+ 'link' => '/bolt/finder/config',\n+ ]]);\n+\n+ $menu['Configuration']->addChild('Main configuration', ['uri' => 'config', 'extras' => [\n+ 'name' => 'Main configuration',\n+ 'icon_one' => 'fa-cog',\n+ 'link' => '/bolt/editfile/config?file=/bolt/config.yaml',\n+ ]]);\n+\n+ $menu['Configuration']->addChild('ContentTypes', ['uri' => 'contenttypes', 'extras' => [\n+ 'name' => 'ContentTypes',\n+ 'icon_one' => 'fa-paint-brush',\n+ 'link' => '/bolt/editfile/config?file=/bolt/contenttypes.yml',\n+ ]]);\n+\n+ $menu['Configuration']->addChild('Taxonomy', ['uri' => 'taxonomy', 'extras' => [\n+ 'name' => 'Taxonomy',\n+ 'icon_one' => 'fa-tags',\n+ 'link' => '/bolt/editfile/config?file=/bolt/taxonomy.yml',\n+ ]]);\n+\n+ $menu['Configuration']->addChild('Menu set up', ['uri' => 'menusetup', 'extras' => [\n+ 'name' => 'Menu set up',\n+ 'type' => 'separator',\n+ 'icon_one' => 'fa-list',\n+ 'link' => '/bolt/editfile/config?file=/bolt/menu.yml',\n+ ]]);\n+\n+ $menu['Configuration']->addChild('Routing set up', ['uri' => 'routing', 'extras' => [\n+ 'name' => 'Routing set up',\n+ 'icon_one' => 'fa-random',\n+ 'link' => '/bolt/editfile/config?file=/bolt/routing.yml',\n+ ]]);\n+\n+ $menu['Configuration']->addChild('Check database', ['uri' => 'database', 'extras' => [\n+ 'name' => 'Check database',\n+ 'type' => 'separator',\n+ 'icon_one' => 'fa-database',\n+ 'link' => '/bolt/finder/config',\n+ ]]);\n+\n+ $menu['Configuration']->addChild('Clear the cache', ['uri' => 'cache', 'extras' => [\n+ 'name' => 'Clear the cache',\n+ 'icon_one' => 'fa-eraser',\n+ 'link' => '/bolt/finder/config',\n+ ]]);\n+\n+ $menu['Configuration']->addChild('Change Log', ['uri' => 'else', 'extras' => [\n+ 'name' => 'Change Log',\n+ 'icon_one' => 'fa-archive',\n+ 'link' => '/bolt/finder/config',\n+ ]]);\n+\n+ $menu['Configuration']->addChild('System Log', ['uri' => 'else', 'extras' => [\n+ 'name' => 'System Log',\n+ 'icon_one' => 'fa-archive',\n+ 'link' => '/bolt/finder/config',\n+ ]]);\n+\n+ $menu['Configuration']->addChild('Set-up checks', ['uri' => 'else', 'extras' => [\n+ 'name' => 'Set-up checks',\n+ 'icon_one' => 'fa-support',\n+ 'link' => '/bolt/finder/config',\n+ ]]);\n+\n+ $menu['Configuration']->addChild('Translations: Messages', ['uri' => 'else', 'extras' => [\n+ 'name' => 'Translations: Messages',\n+ 'type' => 'separator',\n+ 'icon_one' => 'fa-flag',\n+ 'link' => '/bolt/finder/config',\n+ ]]);\n+\n+ // File Management submenu\n+ $menu->addChild('File Management', ['uri' => 'content-files', 'extras' => [\n+ 'name' => 'File Management',\n'icon_one' => 'fa-flag',\n'link' => '/bolt/finder/files',\n]]);\n- $menu->addChild('Theme Files', ['uri' => 'theme-files', 'extras' => [\n- 'name' => 'Theme Files',\n- 'icon_one' => 'fa-flag',\n+ $menu['File Management']->addChild('Uploaded files', ['uri' => 'content-files', 'extras' => [\n+ 'name' => 'Uploaded files',\n+ 'icon_one' => 'fa-folder-open-o',\n+ 'link' => '/bolt/finder/files',\n+ ]]);\n+\n+ $menu['File Management']->addChild('View/edit Templates', ['uri' => 'theme-files', 'extras' => [\n+ 'name' => 'View/edit Templates',\n+ 'icon_one' => 'fa-desktop',\n'link' => '/bolt/finder/themes',\n]]);\n- $menu->addChild('Users', ['uri' => 'users', 'extras' => [\n- 'name' => 'Users',\n- 'icon_one' => 'fa-users',\n- 'link' => '/bolt/users',\n+ $menu->addChild('Extensions', ['uri' => 'extensions', 'extras' => [\n+ 'name' => 'Extensions',\n+ 'icon_one' => 'fa-cubes',\n+ 'link' => '/bolt/extensions',\n]]);\n$this->stopwatch->stop('bolt.sidebar');\n@@ -148,6 +232,30 @@ class MenuBuilder\n$menuData = [];\nforeach ($menu as $child) {\n+\n+ $submenu = [];\n+\n+ if( $child->hasChildren() ) {\n+ foreach ($child->getChildren() as $submenuChild) {\n+\n+ $submenu[] = [\n+ 'name' => $submenuChild->getExtra('name') ?: $submenuChild->getLabel(),\n+ 'singular_name' => $submenuChild->getExtra('singular_name'),\n+ 'slug' => $submenuChild->getExtra('slug'),\n+ 'singular_slug' => $submenuChild->getExtra('singular_slug'),\n+ 'icon_one' => $submenuChild->getExtra('icon_one'),\n+ 'icon_many' => $submenuChild->getExtra('icon_many'),\n+ 'link' => $submenuChild->getExtra('link'),\n+ 'link_new' => $submenuChild->getExtra('link_new'),\n+ 'contenttype' => $submenuChild->getExtra('contenttype'),\n+ 'singleton' => $submenuChild->getExtra('singleton'),\n+ 'type' => $submenuChild->getExtra('type'),\n+ 'active' => $submenuChild->getExtra('active'),\n+ ];\n+\n+ }\n+ }\n+\n$menuData[] = [\n'name' => $child->getExtra('name') ?: $child->getLabel(),\n'singular_name' => $child->getExtra('singular_name'),\n@@ -161,7 +269,7 @@ class MenuBuilder\n'singleton' => $child->getExtra('singleton'),\n'type' => $child->getExtra('type'),\n'active' => $child->getExtra('active'),\n- 'records' => $child->getExtra('records'),\n+ 'submenu' => $child->hasChildren() ? $submenu : null,\n];\n}\n" } ]
PHP
MIT License
bolt/core
Add Configuration and File management submenus
95,144
26.10.2018 20:15:26
-7,200
b92d75fd18cbed60ae0f3503395f910ce8ffd660
Hotfix: Make sqlite work again.
[ { "change_type": "MODIFY", "old_path": "config/packages/doctrine.yaml", "new_path": "config/packages/doctrine.yaml", "diff": "@@ -9,7 +9,10 @@ doctrine:\ndriver: 'pdo_sqlite'\nserver_version: '3.15'\ncharset: utf8mb4\n- url: '%bolt.database.url%'\n+ url: '%env(resolve:DATABASE_URL)%'\n+ # url: '%bolt.database.url%'\n+ # TODO: the url is `sqlite:///%kernel.project_dir%/var/data/blog.sqlite`, meaning that Kernel.php\n+ # sets the values, but doesn't resolve the %vars%\norm:\nauto_generate_proxy_classes: '%kernel.debug%'\nnaming_strategy: doctrine.orm.naming_strategy.underscore\n" } ]
PHP
MIT License
bolt/core
Hotfix: Make sqlite work again.