{"id":28759918,"url":"https://github.com/codevise/krant","last_synced_at":"2025-07-23T12:33:42.985Z","repository":{"id":56880494,"uuid":"114279162","full_name":"codevise/krant","owner":"codevise","description":"Display app news and broadcast messages in Active Admin","archived":false,"fork":false,"pushed_at":"2024-01-03T08:43:39.000Z","size":70,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-17T05:42:50.188Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codevise.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-12-14T17:38:38.000Z","updated_at":"2024-02-29T06:09:26.000Z","dependencies_parsed_at":"2024-01-03T10:07:18.535Z","dependency_job_id":null,"html_url":"https://github.com/codevise/krant","commit_stats":{"total_commits":36,"total_committers":2,"mean_commits":18.0,"dds":0.08333333333333337,"last_synced_commit":"3ec98e0c1d4e3bd04dd3033e01f7a925b324749c"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/codevise/krant","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codevise%2Fkrant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codevise%2Fkrant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codevise%2Fkrant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codevise%2Fkrant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codevise","download_url":"https://codeload.github.com/codevise/krant/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codevise%2Fkrant/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265893139,"owners_count":23845119,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-17T05:42:26.823Z","updated_at":"2025-07-23T12:33:42.974Z","avatar_url":"https://github.com/codevise.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Krant\n\n[![Gem Version](https://badge.fury.io/rb/krant.svg)](http://badge.fury.io/rb/krant)\n\nDisplay app news and broadcast messages in Active Admin.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'krant'\n```\n\nAnd then execute:\n\n```\n$ bundle\n```\n\nInclude javascripts and stylesheets:\n\n```scss\n// app/assets/stylesheets/active_admin.scss\n\n// After active_admin/base has been imported\n@import \"krant/active_admin\";\n```\n\nInstall migrations and migrate:\n\n```\n$ bin/rake krant:install:migrations\n$ bin/rake db:migrate\n```\n\n### Display Broadcast Messages\n\nConfigure the Active Admin view component and add the broadcast\nmessages admin to the load path:\n\n```ruby\n# config/initializers/active_admin.rb\nActiveAdmin.application.load_paths.unshift(Krant.active_admin_load_path)\n\nActiveAdmin.setup do |config|\n  config.view_factory.header = Krant::Views::HeaderWithBroadcastMessages\nend\n```\n\nConfigure for which locales you want to enter broadcast message\ntranslations. The corresponding text fields will be displayed:\n\n```ruby\n# config/initializers/krant.rb\nKrant.broadcast_message_locales = [:en, :fr, :es]\n```\n\nMessages with different translations can now be configured via the\nadmin interface and will be displayed once marked as active.\nBroadcast messages have full markdown support.\n\nThe color of the broadcast message bar can be configured via SCSS\n\n```scss\n// app/assets/stylesheets/active_admin.scss\n\n$krant-broadcast-message-bar-color: #fff3bd;\n$krant-broadcast-message-bar-border-color: transparent;\n\n@import \"krant/active_admin\";\n```\n\n### Displaying a News Page\n\nProvide a news collection:\n\n```ruby\n# lib/my_app.rb\nmodule MyApp\n  def self.news\n    @news ||= Krant::News.about(MyApp)\n  end\nend\n```\n\nThe passed parameter is only used as a namespace for item names. You\ncan also pass a string. Passing a constant is an easy way to ensure\nuniqness.\n\nAdd a news page:\n\n```ruby\n# app/admins/news.rb\nActiveAdmin.register_page 'news' do\n  Krant.active_admin_news_page(self)\n\n  content title: 'News' do\n    krant_news_list(MyApp.news)\n  end\nend\n```\n\nIf you are using the CanCan authorization adapter, grant access to the\npage and its `seen` action:\n\n```ruby\n# app/models/ability.rb\ncan [:read, :seen], ActiveAdmin::Page, name: 'news'\n```\n\nAdd a link to the news page into the utility navigation:\n\n```ruby\n# config/initializers/active_admin.rb\nconfig.namespace :admin do |admin|\n  admin.build_menu :utility_navigation do |menu|\n    Krant.add_active_admin_news_menu_item_to(menu,\n                                             news: MyApp.news,\n                                             url: -\u003e { admin_news_path })\n  end\nend\n```\nCreate news items for new features:\n\n```ruby\n# config/initializers/news/some_new_feature.rb\nMyApp.news.item(:some_new_feature,\n                 title: {\n                   en: 'Some title',\n                   de: 'Ein Titel'\n                 },\n                 body: {\n                   en: 'Some text using [Markdown](http://http://commonmark.org/).',\n                   de: 'Text mit [Markdown](http://http://commonmark.org/).',\n                 })\n```\n\nDefine a Rake tasks to persists news items in the database:\n\n```ruby\n# Rakefile\nrequire 'krant/tasks'\nKrant::Tasks.install { MyApp.news }\n```\n\nand run the defined task after each deploy:\n\n```\n$ bin/rake news:persist\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install\ndependencies. You can also run `bin/console` for an interactive prompt\nthat will allow you to experiment.\n\nTo run the tests install bundled gems and invoke RSpec:\n\n```\n$ bundle\n$ bundle exec rspec\n```\n\nThe test suite can be run against different versions of Rails and\nActive Admin (see `Appraisals` file):\n\n```\n$ appraisal install\n$ appraisal rspec\n```\n\nTo install this gem onto your local machine, run `bundle exec rake\ninstall`. To release a new version, update the version number in\n`version.rb`, and then run `bundle exec rake release`, which will\ncreate a git tag for the version, push git commits and tags, and push\nthe `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at\nhttps://github.com/codevise/krant. This project is intended to be a\nsafe, welcoming space for collaboration, and contributors are expected\nto adhere to the\n[Contributor Covenant](http://contributor-covenant.org) code of\nconduct.\n\n## License\n\nThe gem is available as open source under the terms of the\n[MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodevise%2Fkrant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodevise%2Fkrant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodevise%2Fkrant/lists"}